:root {
  --app-sidebar-width: 280px;
  --app-bg: #f6f7f9;
  --app-panel: #ffffff;
  --app-border: #dfe3e8;
  --app-text: #17202a;
  --app-muted: #667085;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--app-bg);
  color: var(--app-text);
  font-size: 14px;
  letter-spacing: 0;
}

.login-body {
  background:
    linear-gradient(135deg, rgba(13, 110, 253, 0.08), rgba(25, 135, 84, 0.08)),
    var(--app-bg);
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-panel {
  width: min(100%, 430px);
  background: var(--app-panel);
  border: 1px solid var(--app-border);
  border-radius: 8px;
  padding: 32px;
  box-shadow: 0 18px 60px rgba(15, 23, 42, 0.12);
}

.login-panel h1 {
  font-size: 28px;
  margin: 16px 0 6px;
}

.brand-lock {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #0d6efd;
  color: #fff;
  font-size: 26px;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--app-sidebar-width) 1fr;
}

.app-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 20px;
  background: #ffffff;
  border-right: 1px solid var(--app-border);
}

.app-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--app-text);
  text-decoration: none;
}

.app-brand span {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  background: #0d6efd;
}

.app-nav {
  gap: 4px;
}

.app-nav .nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  color: #344054;
  border-radius: 8px;
  padding: 9px 12px;
}

.app-nav .nav-link.active,
.app-nav .nav-link:hover {
  color: #0b5ed7;
  background: #eef5ff;
}

.sidebar-user {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--app-border);
}

.app-main {
  min-width: 0;
  padding: 24px;
}

.app-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.app-topbar h1 {
  margin: 0;
  font-size: 26px;
  line-height: 1.2;
}

.section-panel,
.print-sheet {
  background: var(--app-panel);
  border: 1px solid var(--app-border);
  border-radius: 8px;
  padding: 22px;
}

.section-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.section-heading h2 {
  margin: 0;
  font-size: 20px;
}

.section-heading p {
  margin: 4px 0 0;
  color: var(--app-muted);
}

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

.metric-tile {
  min-height: 142px;
  background: var(--app-panel);
  border: 1px solid var(--app-border);
  border-radius: 8px;
  padding: 18px;
}

.metric-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 20px;
}

.metric-tile span,
.metric-tile small {
  display: block;
  color: var(--app-muted);
}

.metric-tile strong {
  display: block;
  font-size: 24px;
  margin: 2px 0;
}

.item-table-wrap {
  border: 1px solid var(--app-border);
  border-radius: 8px;
}

.item-table {
  margin-bottom: 0;
}

.item-table th,
.item-table td {
  min-width: 140px;
}

.item-table th:first-child,
.item-table td:first-child {
  min-width: 280px;
}

.stock-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.stock-chips span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 3px 8px;
  border: 1px solid var(--app-border);
  border-radius: 8px;
  background: #f8fafc;
  font-size: 12px;
}

.selected-document {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.selected-document > div {
  border: 1px solid var(--app-border);
  border-radius: 8px;
  padding: 12px;
  background: #f8fafc;
}

.selected-document span {
  display: block;
  color: var(--app-muted);
  font-size: 12px;
}

.permission-matrix {
  border: 1px solid var(--app-border);
  border-radius: 8px;
  overflow: hidden;
}

.permission-row {
  display: grid;
  grid-template-columns: 1fr 110px 110px;
  align-items: center;
  min-height: 44px;
  padding: 0 14px;
  border-top: 1px solid var(--app-border);
}

.permission-row:first-child {
  border-top: 0;
}

.permission-head {
  background: #f8fafc;
  font-weight: 700;
}

.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--app-muted);
}

.empty-state i {
  display: block;
  margin-bottom: 12px;
  font-size: 42px;
  color: #98a2b3;
}

.empty-state h2 {
  color: var(--app-text);
  font-size: 22px;
}

.print-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-bottom: 16px;
}

.print-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 20px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--app-border);
}

.print-header h2 {
  margin: 0;
  font-size: 28px;
}

.print-sheet h3 {
  font-size: 14px;
  text-transform: uppercase;
  color: var(--app-muted);
}

@media (max-width: 1100px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .app-sidebar {
    position: static;
    height: auto;
  }

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

@media (max-width: 700px) {
  .app-main,
  .app-sidebar {
    padding: 16px;
  }

  .section-heading,
  .app-topbar,
  .print-header {
    flex-direction: column;
    align-items: stretch;
  }

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

  .permission-row {
    grid-template-columns: 1fr 74px 74px;
  }
}

@media print {
  body {
    background: #fff;
  }

  .app-sidebar,
  .app-topbar,
  .no-print,
  .alert {
    display: none !important;
  }

  .app-shell,
  .app-main {
    display: block;
    padding: 0;
  }

  .print-sheet {
    border: 0;
    padding: 0;
  }
}
