:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-soft: #f1f5f9;
  --text: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-soft: #eff6ff;
  --success: #22c55e;
  --success-soft: #f0fdf4;
  --warning: #f59e0b;
  --warning-soft: #fffbeb;
  --danger: #ef4444;
  --danger-soft: #fef2f2;
  --violet: #7c3aed;
  --violet-soft: #f5f3ff;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04), 0 1px 3px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 12px 30px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 24px 70px rgba(15, 23, 42, 0.16);
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --sidebar-width: 256px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--text);
  background: var(--bg);
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.18);
  outline-offset: 2px;
}

.is-hidden {
  display: none !important;
}

.app-loader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  background: #f8fafc;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

.app-loader.hide {
  opacity: 0;
  visibility: hidden;
}

.loader-brand {
  width: min(360px, calc(100vw - 48px));
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px;
  align-items: center;
}

.loader-brand strong,
.login-brand strong {
  display: block;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.loader-brand span,
.login-brand span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.loader-line {
  grid-column: 1 / -1;
  height: 3px;
  margin-top: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: #e2e8f0;
}

.loader-line span {
  display: block;
  width: 45%;
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
  animation: loading-line 1.1s ease-in-out infinite;
}

@keyframes loading-line {
  0% { transform: translateX(-110%); }
  100% { transform: translateX(260%); }
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: #fff;
  border-radius: 13px;
  background: linear-gradient(145deg, #2563eb, #1d4ed8);
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.24);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.brand-mark--large {
  width: 48px;
  height: 48px;
  border-radius: 15px;
  font-size: 14px;
}

.login-screen {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 20px;
  overflow: hidden;
  background:
    linear-gradient(rgba(248, 250, 252, 0.72), rgba(248, 250, 252, 0.93)),
    radial-gradient(circle at 15% 10%, rgba(37, 99, 235, 0.11), transparent 35%),
    radial-gradient(circle at 85% 90%, rgba(124, 58, 237, 0.08), transparent 35%);
}

.login-screen::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.34;
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.14) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.14) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(to bottom, black, transparent 75%);
}

.login-ambient {
  position: absolute;
  border-radius: 50%;
  filter: blur(2px);
  pointer-events: none;
}

.login-ambient--one {
  width: 340px;
  height: 340px;
  top: -130px;
  right: -90px;
  background: rgba(37, 99, 235, 0.07);
}

.login-ambient--two {
  width: 280px;
  height: 280px;
  bottom: -120px;
  left: -80px;
  background: rgba(34, 197, 94, 0.06);
}

.login-card {
  position: relative;
  z-index: 1;
  width: min(440px, 100%);
  padding: 34px;
  border: 1px solid rgba(226, 232, 240, 0.92);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 35px 90px rgba(15, 23, 42, 0.13);
  backdrop-filter: blur(16px);
  animation: card-in 0.55s ease both;
}

@keyframes card-in {
  from { opacity: 0; transform: translateY(18px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.login-copy {
  margin: 38px 0 28px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  color: var(--primary);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.login-copy h1,
.section-intro h1,
.welcome-panel h1 {
  margin: 8px 0 8px;
  color: var(--text);
  font-size: clamp(25px, 3vw, 32px);
  line-height: 1.2;
  letter-spacing: -0.035em;
}

.login-copy p,
.section-intro p,
.welcome-panel p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
}

.login-form,
.modal-form,
.settings-fields {
  display: grid;
  gap: 18px;
}

.field-group {
  display: grid;
  gap: 8px;
  color: #334155;
  font-size: 12px;
  font-weight: 600;
}

.input-shell {
  min-height: 46px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fff;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.input-shell:focus-within {
  border-color: rgba(37, 99, 235, 0.58);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.08);
}

.input-shell > svg,
.search-field > svg {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
  color: #94a3b8;
}

.input-shell input,
.input-shell select,
.input-shell textarea {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
  font-size: 13px;
}

.input-shell select {
  appearance: none;
  cursor: pointer;
}

.input-shell--textarea {
  align-items: flex-start;
  padding-top: 13px;
}

.input-shell textarea {
  resize: vertical;
  line-height: 1.5;
}

.icon-button {
  width: 38px;
  height: 38px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--muted);
  background: #fff;
  cursor: pointer;
  transition: all 0.2s ease;
}

.icon-button:hover {
  color: var(--text);
  border-color: var(--line-strong);
  background: #f8fafc;
  transform: translateY(-1px);
}

.icon-button svg {
  width: 17px;
  height: 17px;
}

.icon-button--inside {
  width: 30px;
  height: 30px;
  margin-right: -5px;
  border: 0;
  background: transparent;
}

.login-helper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 11px;
}

.check-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.check-label input {
  width: 15px;
  height: 15px;
  accent-color: var(--primary);
}

.primary-button,
.secondary-button,
.danger-button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.primary-button {
  border: 1px solid var(--primary);
  color: #fff;
  background: var(--primary);
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.2);
}

.primary-button:hover {
  border-color: var(--primary-dark);
  background: var(--primary-dark);
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.25);
  transform: translateY(-1px);
}

.secondary-button {
  border: 1px solid var(--line);
  color: #334155;
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.secondary-button:hover {
  border-color: var(--line-strong);
  background: #f8fafc;
  transform: translateY(-1px);
}

.danger-button {
  border: 1px solid var(--danger);
  color: #fff;
  background: var(--danger);
  box-shadow: 0 8px 18px rgba(239, 68, 68, 0.18);
}

.danger-button:hover {
  border-color: #dc2626;
  background: #dc2626;
  box-shadow: 0 10px 24px rgba(239, 68, 68, 0.24);
  transform: translateY(-1px);
}

.primary-button svg,
.secondary-button svg,
.danger-button svg {
  width: 16px;
  height: 16px;
}

.primary-button--wide {
  width: 100%;
  min-height: 48px;
  margin-top: 2px;
}

.login-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 10px;
}

.login-footer svg {
  width: 15px;
  height: 15px;
  color: var(--success);
}

.system-shell {
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 60;
  width: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  padding: 22px 16px 16px;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(16px);
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 5px 20px;
}

.login-brand--sidebar .brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 12px;
}

.login-brand--sidebar strong {
  font-size: 13px;
}

.login-brand--sidebar span {
  font-size: 10px;
}

.sidebar-close,
.menu-button,
.mobile-action {
  display: none;
}

.sidebar-nav {
  display: grid;
  gap: 5px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.nav-item {
  width: 100%;
  min-height: 43px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 12px;
  border: 0;
  border-radius: 10px;
  color: var(--muted);
  background: transparent;
  font-size: 12px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.nav-item:hover {
  color: var(--text);
  background: #f8fafc;
  transform: translateX(2px);
}

.nav-item.active {
  color: var(--primary);
  background: var(--primary-soft);
}

.nav-item svg {
  width: 18px;
  height: 18px;
}

.sidebar-info-card {
  margin-top: auto;
  padding: 16px;
  border: 1px solid #dbeafe;
  border-radius: 14px;
  background: linear-gradient(145deg, #eff6ff, #f8fbff);
}

.sidebar-info-icon {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  margin-bottom: 12px;
  border-radius: 9px;
  color: var(--primary);
  background: #dbeafe;
}

.sidebar-info-icon svg {
  width: 17px;
  height: 17px;
}

.sidebar-info-card strong {
  display: block;
  font-size: 11px;
}

.sidebar-info-card p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}

.sidebar-user {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.avatar {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(145deg, #0f172a, #334155);
  font-size: 10px;
  font-weight: 700;
}

.avatar--large {
  width: 42px;
  height: 42px;
  font-size: 11px;
}

.sidebar-user strong,
.sidebar-user span {
  display: block;
}

.sidebar-user strong {
  font-size: 10px;
}

.sidebar-user span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
}

.sidebar-user .icon-button {
  width: 32px;
  height: 32px;
  border: 0;
}

.sidebar-backdrop {
  display: none;
}

.main-content {
  min-height: 100vh;
  margin-left: var(--sidebar-width);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 30px;
  border-bottom: 1px solid rgba(226, 232, 240, 0.92);
  background: rgba(248, 250, 252, 0.9);
  backdrop-filter: blur(16px);
}

.topbar-left,
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-left p {
  margin: 0 0 3px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.topbar-left h2 {
  margin: 0;
  font-size: 18px;
  letter-spacing: -0.025em;
}

.system-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-right: 6px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
}

.system-status span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.11);
}

.content-wrapper {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 28px 30px 44px;
}

.view {
  display: none;
  animation: view-in 0.3s ease both;
}

.view.active-view {
  display: block;
}

@keyframes view-in {
  from { opacity: 0; transform: translateY(7px); }
  to { opacity: 1; transform: translateY(0); }
}

.welcome-panel,
.section-intro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 22px;
}

.welcome-panel {
  padding: 22px 24px;
  overflow: hidden;
  border: 1px solid #dbeafe;
  border-radius: var(--radius-lg);
  background:
    linear-gradient(110deg, rgba(239, 246, 255, 0.96), rgba(255, 255, 255, 0.92)),
    #fff;
  box-shadow: var(--shadow-sm);
}

.welcome-panel h1 {
  margin-top: 6px;
  font-size: 25px;
}

.welcome-panel strong {
  color: var(--warning);
}

.welcome-date {
  min-width: 220px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 15px;
  border: 1px solid rgba(219, 234, 254, 0.95);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.75);
}

.welcome-date > svg {
  width: 21px;
  height: 21px;
  color: var(--primary);
}

.welcome-date span,
.welcome-date strong {
  display: block;
}

.welcome-date span {
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.welcome-date strong {
  margin-top: 3px;
  color: var(--text);
  font-size: 11px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.metric-card {
  position: relative;
  min-width: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: start;
  gap: 13px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.metric-card:hover {
  border-color: var(--line-strong);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.07);
  transform: translateY(-2px);
}

.metric-card--alert {
  border-color: #fde68a;
  background: linear-gradient(145deg, #fff, #fffcf4);
}

.metric-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 11px;
}

.metric-icon svg {
  width: 18px;
  height: 18px;
}

.metric-icon--blue { color: var(--primary); background: var(--primary-soft); }
.metric-icon--green { color: #16a34a; background: var(--success-soft); }
.metric-icon--violet { color: var(--violet); background: var(--violet-soft); }
.metric-icon--amber { color: #d97706; background: var(--warning-soft); }

.metric-content {
  min-width: 0;
}

.metric-content > span {
  display: block;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric-content > strong {
  display: block;
  margin: 6px 0 7px;
  font-size: 24px;
  line-height: 1;
  letter-spacing: -0.04em;
}

.metric-content small {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 8.5px;
}

.metric-content small svg {
  width: 12px;
  height: 12px;
}

.dashboard-grid,
.movement-page-grid,
.settings-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(280px, 0.8fr);
  gap: 14px;
  margin-bottom: 14px;
}

.panel {
  min-width: 0;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

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

.panel-label {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.panel-header h3,
.settings-card-header h3,
.action-sheet-panel h3 {
  margin: 0;
  font-size: 15px;
  letter-spacing: -0.025em;
}

.chart-legend {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 600;
}

.chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-dot {
  width: 7px;
  height: 7px;
  display: inline-block;
  border-radius: 50%;
}

.legend-dot--entry { background: var(--primary); }
.legend-dot--exit { background: #94a3b8; }

.chart-container {
  position: relative;
  height: 240px;
}

.text-button {
  padding: 0;
  border: 0;
  color: var(--primary);
  background: transparent;
  font-size: 9px;
  font-weight: 700;
  cursor: pointer;
}

.text-button:hover {
  text-decoration: underline;
}

.stock-summary-content {
  min-height: 240px;
  display: grid;
  grid-template-columns: 150px 1fr;
  align-items: center;
  gap: 14px;
}

.donut-wrap {
  position: relative;
  width: 145px;
  height: 145px;
}

.donut-center {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
  pointer-events: none;
}

.donut-center strong {
  font-size: 23px;
  line-height: 1;
}

.donut-center span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 8px;
  text-transform: uppercase;
}

.stock-stats {
  display: grid;
  gap: 16px;
}

.stock-stats > div {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 10px;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.status-dot--normal { background: var(--primary); }
.status-dot--warning { background: var(--warning); }

.stock-stats strong,
.stock-stats span {
  display: block;
}

.stock-stats strong {
  font-size: 15px;
}

.stock-stats span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
}

.recent-panel {
  padding-bottom: 8px;
}

.movement-list {
  display: grid;
}

.movement-row {
  display: grid;
  grid-template-columns: auto minmax(160px, 1fr) minmax(110px, 0.5fr) minmax(92px, auto);
  align-items: center;
  gap: 13px;
  padding: 12px 2px;
  border-top: 1px solid var(--line);
}

.movement-row:first-child {
  border-top: 0;
  padding-top: 3px;
}

.movement-type-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 10px;
}

.movement-type-icon svg {
  width: 16px;
  height: 16px;
}

.movement-type-icon--entry { color: #16a34a; background: var(--success-soft); }
.movement-type-icon--exit { color: var(--violet); background: var(--violet-soft); }

.movement-main strong,
.movement-main span,
.movement-meta strong,
.movement-meta span {
  display: block;
}

.movement-main strong,
.movement-meta strong {
  font-size: 10px;
}

.movement-main span,
.movement-meta span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 8.5px;
}

.movement-quantity {
  justify-self: end;
  font-size: 12px;
  font-weight: 700;
}

.movement-quantity--entry { color: #16a34a; }
.movement-quantity--exit { color: var(--danger); }

.section-intro {
  align-items: flex-end;
}

.section-intro h1 {
  margin-top: 5px;
  font-size: 26px;
}

.table-panel {
  padding: 0;
  overflow: hidden;
}

.table-toolbar,
.history-toolbar {
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}

.search-field {
  min-width: 230px;
  height: 38px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-field:focus-within {
  border-color: rgba(37, 99, 235, 0.55);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.07);
}

.search-field input {
  width: 100%;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
  font-size: 11px;
}

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

.select-field {
  height: 38px;
  padding: 0 32px 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: #334155;
  background-color: #fff;
  font-size: 10px;
  cursor: pointer;
}

.table-responsive {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 13px 18px;
  text-align: left;
  white-space: nowrap;
}

th {
  color: var(--muted);
  background: #fbfdff;
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

td {
  border-top: 1px solid var(--line);
  color: #334155;
  font-size: 10px;
}

tbody tr {
  transition: background 0.18s ease;
}

tbody tr:hover {
  background: #fbfdff;
}

.product-cell {
  display: flex;
  align-items: center;
  gap: 11px;
}

.product-thumb {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: var(--primary);
  background: var(--primary-soft);
  font-size: 9px;
  font-weight: 800;
}

.product-cell strong,
.product-cell span {
  display: block;
}

.product-cell strong {
  color: var(--text);
  font-size: 10px;
}

.product-cell span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 8px;
}

.stock-value {
  display: flex;
  align-items: center;
  gap: 8px;
}

.stock-value strong {
  min-width: 24px;
  color: var(--text);
  font-size: 11px;
}

.stock-mini-bar {
  width: 54px;
  height: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-soft);
}

.stock-mini-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
}

.stock-mini-bar.low span {
  background: var(--warning);
}

.badge {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 8.5px;
  font-weight: 700;
}

.badge::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
}

.badge--success {
  color: #15803d;
  background: var(--success-soft);
}

.badge--success::before { background: var(--success); }

.badge--warning {
  color: #b45309;
  background: var(--warning-soft);
}

.badge--warning::before { background: var(--warning); }

.table-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 230px;
}

.action-button {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-size: 8.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.18s ease;
}

.action-button svg {
  width: 12px;
  height: 12px;
}

.action-button:hover {
  transform: translateY(-1px);
}

.action-button--entry {
  color: #15803d;
}

.action-button--entry:hover {
  border-color: #bbf7d0;
  background: var(--success-soft);
}

.action-button--exit {
  color: var(--danger);
}

.action-button--exit:hover {
  border-color: #fecaca;
  background: var(--danger-soft);
}

.action-button--delete {
  color: #64748b;
}

.action-button--delete:hover {
  border-color: #fecaca;
  color: var(--danger);
  background: var(--danger-soft);
}

.empty-state {
  display: grid;
  justify-items: center;
  padding: 50px 20px;
  text-align: center;
}

.empty-state svg {
  width: 30px;
  height: 30px;
  margin-bottom: 12px;
  color: #94a3b8;
}

.empty-state strong {
  font-size: 12px;
}

.empty-state p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 10px;
}

.movement-action-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.movement-action-card {
  position: relative;
  min-height: 178px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: start;
  gap: 16px;
  padding: 24px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  text-align: left;
  background: #fff;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}

.movement-action-card::after {
  content: "";
  position: absolute;
  right: -60px;
  bottom: -70px;
  width: 170px;
  height: 170px;
  border-radius: 50%;
  opacity: 0.55;
  transition: transform 0.25s ease;
}

.movement-action-card--entry::after { background: var(--success-soft); }
.movement-action-card--exit::after { background: var(--violet-soft); }

.movement-action-card:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
}

.movement-action-card:hover::after {
  transform: scale(1.14);
}

.movement-card-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 13px;
}

.movement-card-icon svg {
  width: 21px;
  height: 21px;
}

.movement-action-card--entry .movement-card-icon { color: #16a34a; background: var(--success-soft); }
.movement-action-card--exit .movement-card-icon { color: var(--violet); background: var(--violet-soft); }

.movement-action-card span,
.movement-action-card strong,
.movement-action-card p {
  display: block;
}

.movement-action-card span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.movement-action-card strong {
  margin-top: 7px;
  font-size: 16px;
  letter-spacing: -0.02em;
}

.movement-action-card p {
  max-width: 360px;
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.55;
}

.movement-arrow {
  position: relative;
  z-index: 2;
  width: 18px;
  height: 18px;
  color: #94a3b8;
}

.daily-flow {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 18px;
  min-height: 105px;
}

.flow-item {
  display: flex;
  align-items: center;
  gap: 13px;
}

.flow-icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 12px;
}

.flow-icon svg {
  width: 18px;
  height: 18px;
}

.flow-icon--entry { color: #16a34a; background: var(--success-soft); }
.flow-icon--exit { color: var(--violet); background: var(--violet-soft); }

.flow-item span,
.flow-item strong {
  display: block;
}

.flow-item span {
  color: var(--muted);
  font-size: 9px;
}

.flow-item strong {
  margin-top: 4px;
  font-size: 13px;
}

.flow-divider {
  width: 1px;
  height: 52px;
  background: var(--line);
}

.restock-list {
  display: grid;
  gap: 8px;
}

.restock-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px;
  border-radius: 10px;
  background: var(--warning-soft);
}

.restock-item .product-thumb {
  color: #b45309;
  background: #fef3c7;
}

.restock-item > div:nth-child(2) {
  flex: 1;
  min-width: 0;
}

.restock-item strong,
.restock-item span {
  display: block;
}

.restock-item strong {
  overflow: hidden;
  font-size: 9.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.restock-item span {
  margin-top: 3px;
  color: #b45309;
  font-size: 8px;
}

.restock-item button {
  border: 0;
  color: var(--primary);
  background: transparent;
  font-size: 8px;
  font-weight: 700;
  cursor: pointer;
}

.history-panel {
  padding: 0;
  overflow: hidden;
}

.segment-control {
  display: inline-flex;
  align-items: center;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fafc;
}

.segment-control button {
  min-height: 30px;
  padding: 0 12px;
  border: 0;
  border-radius: 7px;
  color: var(--muted);
  background: transparent;
  font-size: 9px;
  font-weight: 700;
  cursor: pointer;
}

.segment-control button.active {
  color: var(--text);
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.timeline {
  padding: 24px 26px 28px;
}

.timeline-day {
  display: grid;
  grid-template-columns: 105px 1fr;
  gap: 24px;
  padding-bottom: 24px;
}

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

.timeline-date strong,
.timeline-date span {
  display: block;
}

.timeline-date strong {
  font-size: 10px;
}

.timeline-date span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 8.5px;
}

.timeline-items {
  position: relative;
  display: grid;
  gap: 12px;
}

.timeline-items::before {
  content: "";
  position: absolute;
  top: 16px;
  bottom: -25px;
  left: 15px;
  width: 1px;
  background: var(--line);
}

.timeline-day:last-child .timeline-items::before {
  bottom: 16px;
}

.timeline-item {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 13px;
  padding: 12px 14px 12px 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.timeline-item:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-sm);
  transform: translateX(2px);
}

.timeline-marker {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  margin-left: 0;
  border-radius: 0 9px 9px 0;
}

.timeline-marker svg {
  width: 14px;
  height: 14px;
}

.timeline-marker--entry { color: #16a34a; background: var(--success-soft); }
.timeline-marker--exit { color: var(--danger); background: var(--danger-soft); }

.timeline-main strong,
.timeline-main span,
.timeline-side strong,
.timeline-side span {
  display: block;
}

.timeline-main strong {
  font-size: 10px;
}

.timeline-main span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 8.5px;
}

.timeline-side {
  text-align: right;
}

.timeline-side strong {
  font-size: 10px;
}

.timeline-side span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 8px;
}

.settings-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.settings-card {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.settings-card-header {
  display: flex;
  align-items: center;
  gap: 13px;
}

.settings-card-header p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 9px;
}

.settings-icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: var(--primary);
  background: var(--primary-soft);
}

.settings-icon--purple {
  color: var(--violet);
  background: var(--violet-soft);
}

.settings-icon svg {
  width: 18px;
  height: 18px;
}

.settings-card .primary-button {
  align-self: flex-start;
}

.user-access-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.user-access-info {
  flex: 1;
}

.user-access-info strong,
.user-access-info span {
  display: block;
}

.user-access-info strong {
  font-size: 10px;
}

.user-access-info span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 8.5px;
}

.settings-note,
.modal-summary {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 12px;
  border-radius: 10px;
  color: var(--muted);
  background: #f8fafc;
}

.settings-note svg,
.modal-summary svg {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  color: var(--primary);
}

.settings-note p,
.modal-summary p {
  margin: 0;
  font-size: 8.5px;
  line-height: 1.5;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.22s ease, visibility 0.22s ease;
}

.modal.open {
  opacity: 1;
  visibility: visible;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.48);
  backdrop-filter: blur(4px);
}

.modal-dialog {
  position: relative;
  z-index: 1;
  width: min(560px, 100%);
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  border: 1px solid rgba(226, 232, 240, 0.95);
  border-radius: 18px;
  background: #fff;
  box-shadow: var(--shadow-lg);
  transform: translateY(12px) scale(0.985);
  transition: transform 0.24s ease;
}

.modal.open .modal-dialog {
  transform: translateY(0) scale(1);
}

.modal-dialog--small {
  width: min(480px, 100%);
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 22px 18px;
  border-bottom: 1px solid var(--line);
}

.modal-header h2 {
  margin: 5px 0 0;
  font-size: 19px;
  letter-spacing: -0.03em;
}

.modal-form {
  padding: 20px 22px 22px;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  padding-top: 3px;
}

.eyebrow--danger {
  color: var(--danger);
}

.delete-product-warning {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px;
  align-items: start;
  margin-bottom: 14px;
  padding: 16px;
  border: 1px solid #fecaca;
  border-radius: 12px;
  background: var(--danger-soft);
}

.delete-product-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: var(--danger);
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.delete-product-icon svg {
  width: 18px;
  height: 18px;
}

.delete-product-warning strong {
  display: block;
  font-size: 12px;
}

.delete-product-warning p {
  margin: 5px 0 0;
  color: #991b1b;
  font-size: 10px;
  line-height: 1.55;
}

.modal-summary--neutral {
  margin-bottom: 14px;
  color: var(--muted);
  background: var(--surface-soft);
}

.action-sheet {
  display: none;
}

.toast-container {
  position: fixed;
  z-index: 200;
  top: 18px;
  right: 18px;
  width: min(340px, calc(100vw - 36px));
  display: grid;
  gap: 10px;
  pointer-events: none;
}

.toast {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: start;
  gap: 10px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(14px);
  pointer-events: auto;
  animation: toast-in 0.28s ease both;
}

.toast.removing {
  animation: toast-out 0.22s ease both;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(-8px) translateX(12px); }
  to { opacity: 1; transform: translate(0); }
}

@keyframes toast-out {
  to { opacity: 0; transform: translateX(20px); }
}

.toast-icon {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #16a34a;
  background: var(--success-soft);
}

.toast-icon--error {
  color: var(--danger);
  background: var(--danger-soft);
}

.toast-icon svg {
  width: 15px;
  height: 15px;
}

.toast strong,
.toast span {
  display: block;
}

.toast strong {
  font-size: 10px;
}

.toast span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 8.5px;
  line-height: 1.4;
}

.toast button {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 7px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

.toast button svg {
  width: 13px;
  height: 13px;
}

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

  .dashboard-grid {
    grid-template-columns: minmax(0, 1.35fr) minmax(250px, 0.8fr);
  }

  .stock-summary-content {
    grid-template-columns: 120px 1fr;
  }

  .donut-wrap {
    width: 118px;
    height: 118px;
  }

  .movement-row {
    grid-template-columns: auto minmax(150px, 1fr) minmax(90px, auto);
  }

  .movement-row .movement-meta:nth-of-type(2) {
    display: none;
  }
}

@media (max-width: 960px) {
  :root {
    --sidebar-width: 240px;
  }

  .sidebar {
    transform: translateX(-105%);
    box-shadow: var(--shadow-lg);
    transition: transform 0.26s ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-close,
  .menu-button {
    display: inline-grid;
  }

  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 55;
    display: block;
    opacity: 0;
    visibility: hidden;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(2px);
    transition: opacity 0.22s ease, visibility 0.22s ease;
  }

  .sidebar-backdrop.open {
    opacity: 1;
    visibility: visible;
  }

  .main-content {
    margin-left: 0;
  }

  .topbar {
    padding: 0 22px;
  }

  .content-wrapper {
    padding: 24px 22px 40px;
  }

  .dashboard-grid,
  .movement-page-grid,
  .settings-grid {
    grid-template-columns: 1fr;
  }

  .stock-summary-content {
    grid-template-columns: 150px 1fr;
  }

  .donut-wrap {
    width: 145px;
    height: 145px;
  }
}

@media (max-width: 720px) {
  .login-card {
    padding: 28px 22px;
    border-radius: 20px;
  }

  .topbar {
    height: 68px;
    padding: 0 16px;
  }

  .topbar-left h2 {
    font-size: 16px;
  }

  .system-status,
  .desktop-action {
    display: none;
  }

  .mobile-action {
    display: inline-grid;
    color: #fff;
    border-color: var(--primary);
    background: var(--primary);
  }

  .content-wrapper {
    padding: 20px 14px 32px;
  }

  .welcome-panel,
  .section-intro {
    align-items: flex-start;
    flex-direction: column;
  }

  .welcome-panel {
    padding: 20px;
  }

  .welcome-date {
    width: 100%;
    min-width: 0;
  }

  .metric-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .metric-card {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 15px;
  }

  .metric-content > strong {
    font-size: 22px;
  }

  .metric-content small {
    display: none;
  }

  .panel {
    padding: 17px;
  }

  .panel-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .chart-legend {
    width: 100%;
  }

  .chart-container {
    height: 220px;
  }

  .stock-summary-content {
    min-height: 0;
    grid-template-columns: 128px 1fr;
  }

  .donut-wrap {
    width: 125px;
    height: 125px;
  }

  .movement-row {
    grid-template-columns: auto 1fr auto;
  }

  .movement-row .movement-meta {
    display: none;
  }

  .table-toolbar,
  .history-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .search-field,
  .history-search {
    width: 100%;
    min-width: 0;
  }

  .toolbar-right {
    width: 100%;
  }

  .select-field {
    flex: 1;
  }

  th,
  td {
    padding: 12px 14px;
  }

  .movement-action-grid {
    grid-template-columns: 1fr;
  }

  .movement-action-card {
    min-height: 150px;
    padding: 20px;
  }

  .daily-flow {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .flow-divider {
    width: 100%;
    height: 1px;
  }

  .timeline {
    padding: 20px 16px;
  }

  .timeline-day {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .timeline-date {
    display: flex;
    align-items: baseline;
    gap: 7px;
  }

  .timeline-date span {
    margin: 0;
  }

  .timeline-item {
    grid-template-columns: auto 1fr;
  }

  .timeline-side {
    grid-column: 2;
    text-align: left;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .modal {
    align-items: end;
    padding: 0;
  }

  .modal-dialog,
  .modal-dialog--small {
    width: 100%;
    max-height: 92vh;
    border-radius: 20px 20px 0 0;
    transform: translateY(100%);
  }

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

  .modal-header,
  .modal-form {
    padding-left: 18px;
    padding-right: 18px;
  }

  .action-sheet {
    position: fixed;
    inset: 0;
    z-index: 110;
    display: block;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.22s ease, visibility 0.22s ease;
  }

  .action-sheet.open {
    opacity: 1;
    visibility: visible;
  }

  .action-sheet-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
  }

  .action-sheet-panel {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    padding: 12px 16px 24px;
    border-radius: 20px 20px 0 0;
    background: #fff;
    box-shadow: var(--shadow-lg);
    transform: translateY(100%);
    transition: transform 0.25s ease;
  }

  .action-sheet.open .action-sheet-panel {
    transform: translateY(0);
  }

  .action-sheet-handle {
    width: 36px;
    height: 4px;
    margin: 0 auto 18px;
    border-radius: 999px;
    background: var(--line-strong);
  }

  .action-sheet-panel h3 {
    margin-bottom: 12px;
  }

  .action-sheet-panel > button {
    width: 100%;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border: 0;
    border-top: 1px solid var(--line);
    background: #fff;
    text-align: left;
  }

  .action-sheet-panel > button > svg {
    width: 16px;
    height: 16px;
    color: #94a3b8;
  }

  .sheet-icon {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 11px;
  }

  .sheet-icon svg {
    width: 18px;
    height: 18px;
  }

  .sheet-icon--entry { color: #16a34a; background: var(--success-soft); }
  .sheet-icon--exit { color: var(--violet); background: var(--violet-soft); }

  .action-sheet-panel button strong,
  .action-sheet-panel button small {
    display: block;
  }

  .action-sheet-panel button strong {
    font-size: 11px;
  }

  .action-sheet-panel button small {
    margin-top: 4px;
    color: var(--muted);
    font-size: 8.5px;
  }
}

@media (max-width: 460px) {
  .login-helper {
    align-items: flex-start;
    flex-direction: column;
  }

  .metric-grid {
    grid-template-columns: 1fr;
  }

  .metric-card {
    grid-template-columns: auto 1fr;
  }

  .metric-content small {
    display: flex;
  }

  .stock-summary-content {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: left;
  }

  .stock-stats {
    width: 100%;
    grid-template-columns: 1fr 1fr;
  }

  .movement-action-card {
    grid-template-columns: auto 1fr;
  }

  .movement-arrow {
    display: none;
  }

  .section-intro .secondary-button {
    width: 100%;
  }

  .segment-control {
    width: 100%;
  }

  .segment-control button {
    flex: 1;
  }

  .modal-actions {
    flex-direction: column-reverse;
  }

  .modal-actions button {
    width: 100%;
  }
}

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

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