html {
  background-color: #020617; 
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI",
    sans-serif;
  background: radial-gradient(circle at top, #1f2937 0, #020617 40%, #000 80%);
  background-color: #020617;
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
} 

body.no-scroll {
  overflow: hidden;
}

:root {
  --bg: #050816;
  --bg-soft: #0f172a;
  --bg-softer: #020617;
  --accent: #6366f1;
  --accent-soft: rgba(99, 102, 241, 0.1);
  --accent-strong: #4f46e5;
  --text-main: #e5e7eb;
  --text-muted: #9ca3af;
  --border-subtle: #1f2937;
  --danger: #ef4444;
  --success: #22c55e;
  --shadow-soft: 0 18px 40px rgba(15, 23, 42, 0.7);
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-pill: 999px;
  --transition-fast: 0.15s ease-out;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI",
    sans-serif;
  background: radial-gradient(circle at top, #1f2937 0, #020617 40%, #000 80%);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-shell {
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  padding: 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

header.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.logo-block {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-circle {
  width: 40px;
  height: 40px;
  border-radius: 14px;
  background: radial-gradient(circle at 30% 30%, #f97316, #db2777 40%, #020617 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 30px rgba(248, 250, 252, 0.12);
  font-weight: 700;
  font-size: 18px;
}

.logo-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.logo-text span:first-child {
  font-weight: 600;
  letter-spacing: 0.02em;
}

.logo-text span:last-child {
  color: var(--text-muted);
  font-size: 12px;
}

.user-badge {
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: radial-gradient(circle at top left, rgba(148, 163, 184, 0.2), transparent 55%);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}

.user-badge strong {
  color: var(--text-main);
  font-weight: 500;
}

.btn-small {
  border-radius: 999px;
  border: none;
  background: rgba(15, 23, 42, 0.9);
  color: var(--text-muted);
  padding: 4px 10px;
  font-size: 11px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background var(--transition-fast), color var(--transition-fast),
    transform var(--transition-fast);
}

.btn-small:hover {
  background: rgba(31, 41, 55, 1);
  color: var(--text-main);
  transform: translateY(-0.5px);
}

.pill-status {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(22, 163, 74, 0.08);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.2);
}

.layout-card {
  background: radial-gradient(circle at top left, #020617 0, #020617 25%, #000 80%);
  border-radius: var(--radius-lg);
  padding: 16px;
  border: 1px solid rgba(30, 64, 175, 0.5);
  box-shadow: var(--shadow-soft);
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 0;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  background: radial-gradient(circle at top left, rgba(15, 23, 42, 0.9), rgba(15, 23, 42, 0.7));
  border-radius: var(--radius-pill);
  padding: 4px;
  border: 1px solid var(--border-subtle);
}

.tab-btn {
  flex: 1;
  min-width: 0;
  border-radius: 999px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  padding: 8px 12px;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background var(--transition-fast), color var(--transition-fast),
    transform var(--transition-fast);
}

.tab-btn span.icon {
  font-size: 14px;
}

.tab-btn.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #f9fafb;
  box-shadow: 0 14px 30px rgba(79, 70, 229, 0.65);
  transform: translateY(-1px);
}

.tab-btn:not(.active):hover {
  background: rgba(15, 23, 42, 0.8);
  color: var(--text-main);
}

.content-area {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  gap: 14px;
}

@media (max-width: 900px) {
  .content-area {
    grid-template-columns: minmax(0, 1fr);
  }
}

.card {
  background: radial-gradient(circle at top, rgba(15, 23, 42, 0.85), rgba(15, 23, 42, 0.97));
  border-radius: var(--radius-md);
  border: 1px solid rgba(31, 41, 55, 0.9);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-title {
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-title span.icon {
  font-size: 15px;
  opacity: 0.8;
}

.card-sub {
  font-size: 12px;
  color: var(--text-muted);
}

.chip {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(55, 65, 81, 0.9);
  color: var(--text-muted);
}

.muted {
  color: var(--text-muted);
  font-size: 12px;
}

form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.field-label {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.field-label span.tag {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(55, 65, 81, 0.5);
  color: #e5e7eb;
  text-transform: uppercase;
}

input[type="text"],
input[type="number"],
input[type="password"],
input[type="date"],
input[type="file"],
select {
  width: 100%;
  border-radius: 999px;
  border: 1px solid rgba(55, 65, 81, 0.9);
  padding: 7px 11px;
  background: rgba(15, 23, 42, 0.9);
  color: var(--text-main);
  font-size: 13px;
  outline: none;
  transition: border var(--transition-fast), box-shadow var(--transition-fast),
    background var(--transition-fast), transform var(--transition-fast);
}

input[type="file"] {
  padding: 6px 11px;
  font-size: 12px;
}

input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(129, 140, 248, 0.7);
  background: rgba(15, 23, 42, 1);
  transform: translateY(-0.5px);
}

input::placeholder {
  color: rgba(148, 163, 184, 0.8);
}

.btn-primary,
.btn-outline {
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 13px;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
  transition: background var(--transition-fast), color var(--transition-fast),
    transform var(--transition-fast), box-shadow var(--transition-fast);
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #f9fafb;
  box-shadow: 0 14px 30px rgba(79, 70, 229, 0.6);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 20px 40px rgba(79, 70, 229, 0.7);
}

.btn-outline {
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(75, 85, 99, 0.9);
  color: var(--text-muted);
}

.btn-outline:hover {
  background: rgba(31, 41, 55, 1);
  color: var(--text-main);
  transform: translateY(-0.5px);
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.login-wrapper {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 40px;
  align-items: center;
  justify-content: center;
  flex: 1;
}

.login-card {
  max-width: 360px;
  width: 100%;
  background: radial-gradient(circle at top, rgba(15, 23, 42, 0.95), #020617);
  border-radius: 18px;
  padding: 18px 16px 16px;
  border: 1px solid rgba(37, 99, 235, 0.6);
  box-shadow: var(--shadow-soft);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.login-title {
  font-size: 16px;
  font-weight: 500;
}

.badge-env {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  color: var(--text-muted);
}

.helper-text {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
}

.alert {
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.alert.error {
  background: rgba(248, 113, 113, 0.08);
  border: 1px solid rgba(248, 113, 113, 0.4);
  color: #fecaca;
}

.alert.success {
  background: rgba(52, 211, 153, 0.1);
  border: 1px solid rgba(52, 211, 153, 0.4);
  color: #bbf7d0;
}

.status-line {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: space-between;
  flex-wrap: wrap;
}

.pill {
  border-radius: 999px;
  border: 1px solid rgba(55, 65, 81, 0.9);
  padding: 3px 8px;
  font-size: 11px;
  color: var(--text-muted);
}

.pill span.dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  display: inline-block;
  margin-right: 5px;
  background: #22c55e;
  box-shadow: 0 0 10px rgba(34, 197, 94, 0.6);
}

.table-wrapper {
  border-radius: 14px;
  border: 1px solid rgba(31, 41, 55, 0.9);
  background: rgba(15, 23, 42, 0.8);
  overflow: hidden;
  max-height: 420px;
  display: flex;
  flex-direction: column;
}

.table-scroll {
  overflow-x: auto;
  overflow-y: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  min-width: 100%;
}

th,
td {
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid rgba(31, 41, 55, 0.9);
}

th {
  position: sticky;
  top: 0;
  background: rgba(15, 23, 42, 0.98);
  z-index: 1;
  font-weight: 500;
  color: var(--text-muted);
  backdrop-filter: blur(8px);
}

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

tr:hover td {
  background: rgba(15, 23, 42, 0.85);
}

.tag-type-in {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(34, 197, 94, 0.1);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.4);
}

.tag-type-out {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(239, 68, 68, 0.1);
  color: #fca5a5;
  border: 1px solid rgba(248, 113, 113, 0.4);
}

.pagination-row {
  padding: 6px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-top: 1px solid rgba(31, 41, 55, 0.9);
  font-size: 11px;
  color: var(--text-muted);
}

.pagination-row button {
  border-radius: 999px;
  border: 1px solid rgba(55, 65, 81, 0.9);
  background: rgba(15, 23, 42, 0.95);
  color: var(--text-muted);
  padding: 5px 9px;
  font-size: 11px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: background var(--transition-fast), color var(--transition-fast),
    transform var(--transition-fast);
}

.pagination-row button:hover:not(:disabled) {
  background: rgba(31, 41, 55, 1);
  color: var(--text-main);
  transform: translateY(-0.5px);
}

.pagination-row button:disabled {
  opacity: 0.4;
  cursor: default;
}

.badge-qty {
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 11px;
  background: rgba(15, 23, 42, 1);
  border: 1px solid rgba(55, 65, 81, 0.9);
  color: #e5e7eb;
}

.badge-soft {
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 11px;
  background: rgba(30, 64, 175, 0.18);
  border: 1px solid rgba(129, 140, 248, 0.6);
  color: #c7d2fe;
}

.image-thumb {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  object-fit: cover;
  border: 1px solid rgba(55, 65, 81, 0.9);
}

.empty-state {
  padding: 20px 10px;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
}

[data-view="app"] {
  display: none;
  flex-direction: column;
  gap: 16px;
  flex: 1;
}

[data-view="login"] {
  display: none;
  flex-direction: column;
  flex: 1;
}

[data-view].active {
  display: flex;
}

[data-section] {
  display: none;
  flex-direction: column;
  gap: 10px;
}

[data-section].active {
  display: flex;
}

.image-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.image-modal-backdrop.active {
  display: flex;
}

.image-modal-window {
  background: radial-gradient(circle at top, rgba(15, 23, 42, 0.95), #020617);
  border-radius: 18px;
  border: 1px solid rgba(37, 99, 235, 0.7);
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.9);
  padding: 10px 10px 14px;
  max-width: 420px;
  width: calc(100% - 32px);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.image-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.image-modal-close {
  border-radius: 999px;
  border: 1px solid rgba(75, 85, 99, 0.9);
  background: rgba(15, 23, 42, 0.95);
  color: #e5e7eb;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  cursor: pointer;
  transition: background var(--transition-fast), transform var(--transition-fast);
}

.image-modal-close:hover {
  background: rgba(31, 41, 55, 1);
  transform: translateY(-0.5px);
}

.image-modal-body {
  display: flex;
  justify-content: center;
}

.image-modal-body img {
  max-width: 100%;
  max-height: 320px;
  border-radius: 14px;
  border: 1px solid rgba(55, 65, 81, 0.9);
  object-fit: contain;
}

.field-inline {
  display: flex;
  gap: 8px;
  align-items: center;
}

.field-inline input[type="text"] {
  flex: 1 1 auto;
}

.field-inline .btn-small {
  flex: 0 0 auto;
}

@media (max-width: 640px) {
  header.app-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .card {
    padding: 12px;
  }

  .login-card {
    padding: 16px 14px 14px;
  }

  .tabs {
    justify-content: space-between;
  }

  .tabs .tab-btn {
    flex: 0 0 auto;           
    padding: 8px 10px;       
  }

  .tabs .tab-btn span.icon {
    font-size: 26px;         
  }

  .tabs .tab-btn span:not(.icon) {
    display: none;          
  }	  
}

.content-area[data-section="movements"] .card,
.content-area[data-section="stats"] .card {
  grid-column: 1 / -1;
}

.image-thumb-wrapper {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid rgba(55, 65, 81, 0.9);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.image-thumb-wrapper img.image-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.15s ease-out;
}

.image-thumb-spinner {
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(148, 163, 184, 0.4);
  border-top-color: #e5e7eb;
  animation: thumb-spin 0.4s linear infinite;
  opacity: 1;
  transition: opacity 0.15s ease-out;
}

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

.image-thumb-wrapper.loaded .image-thumb-spinner {
  opacity: 0;
  pointer-events: none;
}

.image-thumb-wrapper.loaded img.image-thumb {
  opacity: 1;
}

.image-modal-body {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 200px;
}

.image-modal-body img {
  max-width: 100%;
  max-height: 320px;
  border-radius: 14px;
  border: 1px solid rgba(55, 65, 81, 0.9);
  object-fit: contain;
  opacity: 0;
  transition: opacity 0.15s ease-out;
}

.image-modal-spinner {
  position: absolute;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid rgba(148, 163, 184, 0.4);
  border-top-color: #e5e7eb;
  animation: thumb-spin 0.4s linear infinite;
  opacity: 1;
  transition: opacity 0.15s ease-out;
}

.image-modal-body.loaded .image-modal-spinner {
  opacity: 0;
  pointer-events: none;
}

.image-modal-body.loaded img {
  opacity: 1;
}

.card-header-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-expand-toggle {
  font-size: 14px;
  padding: 4px 8px;
}

@media (max-width: 900px) {
  .card-expand-toggle {
    display: none;
  }
}

@media (min-width: 901px) {
  .content-area[data-section="inventory"].inventory-expanded .card-inventory-main {
    grid-column: 1 / -1; 
  }
}
