:root {
  --navy: #071a42;
  --blue: #0b4da2;
  --ink: #172033;
  --muted: #657083;
  --line: #dce2eb;
  --panel: #ffffff;
  --bg: #f4f7fb;
  --green: #147a4d;
  --red: #b83232;
  --amber: #b26b00;
  --shadow: 0 18px 45px rgba(20, 38, 72, 0.12);
  --soft-shadow: 0 10px 28px rgba(20, 38, 72, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px 1fr;
  background: var(--bg);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
}

@media (prefers-reduced-motion: no-preference) {
  * {
    scroll-behavior: smooth;
  }
}

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

button {
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease, color 160ms ease, border-color 160ms ease;
}

.sidebar {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 22px;
  background:
    linear-gradient(180deg, rgba(11, 77, 162, 0.32), transparent 260px),
    var(--navy);
  color: #fff;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 70px;
}

.brand img {
  width: 74px;
  height: 74px;
  object-fit: cover;
  border-radius: 8px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.26);
}

.brand strong {
  display: block;
  font-size: 26px;
  line-height: 1;
  letter-spacing: 0;
}

.brand span {
  display: block;
  margin-top: 5px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 13px;
}

.nav {
  display: grid;
  gap: 8px;
}

.nav-item,
.ghost-button {
  min-height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  text-align: left;
  padding: 0 14px;
  position: relative;
  overflow: hidden;
}

.nav-item.active,
.nav-item:hover,
.ghost-button:hover {
  background: #fff;
  color: var(--navy);
  transform: translateX(2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.16);
}

.sidebar-footer {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: auto;
}

.import-label {
  display: grid;
  place-items: center;
}

.import-label input {
  display: none;
}

.shell {
  min-width: 0;
  padding: 28px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
  animation: riseIn 420ms ease both;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--blue);
  font-size: 13px;
  font-weight: 700;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 34px;
}

h2 {
  margin-bottom: 4px;
  font-size: 22px;
}

.toolbar p {
  margin-bottom: 0;
  color: var(--muted);
}

.status-card,
.wallet-summary > div,
.metric {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.status-card {
  min-width: 210px;
  padding: 14px 16px;
  text-align: right;
  box-shadow: var(--soft-shadow);
}

.status-card span,
.wallet-summary span,
.metric span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.status-card strong,
.wallet-summary strong,
.metric strong {
  display: block;
  margin-top: 5px;
  font-size: 24px;
}

.view {
  display: none;
}

.view.active {
  display: block;
  animation: fadeSlide 260ms ease both;
}

.toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
}

.primary-button,
.secondary-button,
.danger-button,
.icon-button {
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 0 14px;
  font-weight: 700;
}

.primary-button {
  background: var(--blue);
  color: #fff;
  box-shadow: 0 8px 18px rgba(11, 77, 162, 0.22);
}

.primary-button:hover,
.secondary-button:hover,
.danger-button:hover,
.icon-button:hover {
  transform: translateY(-1px);
}

.primary-button:hover {
  background: #083f87;
  box-shadow: 0 12px 24px rgba(11, 77, 162, 0.28);
}

.primary-button:active,
.secondary-button:active,
.danger-button:active,
.icon-button:active,
.nav-item:active,
.ghost-button:active {
  transform: translateY(0) scale(0.99);
}

.secondary-button {
  background: #eef2f7;
  color: var(--ink);
  border-color: var(--line);
}

.danger-button {
  min-height: 32px;
  background: #fff4f4;
  color: var(--red);
  border-color: #f1c9c9;
}

.icon-button {
  width: 36px;
  padding: 0;
  background: #eef2f7;
  color: var(--ink);
  font-size: 22px;
}

.table-wrap {
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  animation: riseIn 360ms ease both;
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

th,
td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  background: #eef3f9;
  color: #344057;
  font-size: 12px;
  text-transform: uppercase;
  position: sticky;
  top: 0;
  z-index: 1;
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr {
  transition: background 150ms ease;
}

tbody tr:hover {
  background: #f8fbff;
}

.empty {
  color: var(--muted);
  text-align: center;
  height: 130px;
}

.number {
  font-variant-numeric: tabular-nums;
}

.stock-low {
  color: var(--amber);
  font-weight: 700;
}

.stock-out {
  color: var(--red);
  font-weight: 700;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(170px, 1fr));
  gap: 14px;
}

.metric {
  padding: 18px;
  box-shadow: var(--soft-shadow);
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.metric:hover,
.wallet-summary > div:hover,
.status-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 34px rgba(20, 38, 72, 0.12);
}

.metric.accent {
  border-color: rgba(11, 77, 162, 0.25);
  background: #edf5ff;
}

.metric.warning {
  border-color: rgba(178, 107, 0, 0.24);
  background: #fff7e9;
}

.wallet-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.wallet-summary > div {
  padding: 16px;
  box-shadow: var(--soft-shadow);
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.deposit {
  color: var(--green);
  font-weight: 700;
}

.withdraw {
  color: var(--red);
  font-weight: 700;
}

.modal {
  width: min(460px, calc(100vw - 28px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  box-shadow: 0 30px 90px rgba(9, 21, 44, 0.32);
}

.modal[open] {
  animation: modalIn 180ms ease both;
}

.modal::backdrop {
  background: rgba(7, 26, 66, 0.45);
  animation: backdropIn 180ms ease both;
}

.modal form {
  display: grid;
  gap: 14px;
  padding: 20px;
}

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

.modal h3 {
  margin-bottom: 0;
}

label {
  display: grid;
  gap: 7px;
  color: #344057;
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #cfd8e4;
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  padding: 10px 11px;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(11, 77, 162, 0.12);
  outline: 0;
}

textarea {
  resize: vertical;
}

@keyframes fadeSlide {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes riseIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes backdropIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@media (max-width: 900px) {
  body {
    grid-template-columns: 1fr;
  }

  .sidebar {
    min-height: auto;
  }

  .nav {
    grid-template-columns: repeat(5, minmax(120px, 1fr));
    overflow-x: auto;
  }

  .sidebar-footer {
    max-width: 360px;
  }

  .stats-grid,
  .wallet-summary {
    grid-template-columns: repeat(2, minmax(160px, 1fr));
  }
}

@media (max-width: 620px) {
  .shell {
    padding: 20px 14px;
  }

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

  .status-card {
    min-width: 0;
    text-align: left;
  }

  .stats-grid,
  .wallet-summary {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 28px;
  }
}
