/* Base Reset and Typography */
* {
  box-sizing: border-box;
}

html {
  font-size: 18px;
  background-color: #f8fafc;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
  color: #1e293b;
  background-color: #f8fafc;
}

/* Header */
header.top-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  background-color: #2563eb;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem 0 1rem;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  z-index: 1000;
  user-select: none;
}

header.top-bar .logo-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

header.top-bar .logo-img {
  height: 32px;
  width: auto;
  max-width: 120px;
  object-fit: contain;
  display: block;
}

header.top-bar .logo-text {
  font-weight: 700;
  font-size: 1.2rem;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

header.top-bar button.menu-toggle {
  background: none;
  border: none;
  color: #fff;
  font-size: 1.6rem;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  display: flex;
  align-items: center;
  transition: color 0.2s;
}

header.top-bar button.menu-toggle:hover,
header.top-bar button.menu-toggle:focus {
  color: #facc15; /* yellow accent */
  outline: none;
}

header.top-bar button.logout-btn {
  background: transparent;
  border: 1.5px solid #fff;
  padding: 6px 14px;
  border-radius: 4px;
  color: #fff;
  font-weight: 500;
  cursor: pointer;
  font-size: 0.7rem;
  min-width: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  box-sizing: border-box;
  transition: background-color 0.3s, border-color 0.3s;
}

header.top-bar button.logout-btn:hover,
header.top-bar button.logout-btn:focus {
  background-color: rgba(255, 255, 255, 0.15);
  border-color: #facc15;
  outline: none;
}

/* Drawer Navigation */
nav.drawer-nav {
  position: fixed;
  top: 56px;
  left: -260px;
  width: 260px;
  height: 100%;
  background-color: #1e3a8a;
  color: #fff;
  box-shadow: 2px 0 8px rgba(0, 0, 0, 0.15);
  overflow-y: auto;
  transition: left 0.3s ease;
  z-index: 999;
  display: flex;
  flex-direction: column;
  padding-top: 20px;
}

nav.drawer-nav.open {
  left: 0;
}

nav.drawer-nav a {
  padding: 14px 20px;
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: 10px;
  border-left: 5px solid transparent;
  transition: background-color 0.2s, border-color 0.2s;
}

nav.drawer-nav a.active,
nav.drawer-nav a:hover {
  background-color: #2563eb;
  border-left-color: #facc15;
}

nav.drawer-nav a span.icon {
  font-size: 1.3rem;
}

/* Overlay for drawer */
div.drawer-overlay {
  position: fixed;
  top: 56px;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.3);
  display: none;
  z-index: 998;
}

div.drawer-overlay.visible {
  display: block;
}

/* Main content area */
main.content-area {
  margin-top: 56px;
  padding: 1rem 1.25rem 3rem;
  max-width: 960px;
  margin-left: auto;
  margin-right: auto;
}

/* Shortcut boxes */
div.shortcuts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

div.shortcut-box {
  background-color: #fff;
  border-radius: 10px;
  padding: 1rem 1.2rem;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
  font-size: 1rem;
  color: #2563eb;
  transition: background-color 0.3s, box-shadow 0.3s, color 0.3s;
}

div.shortcut-box:hover,
div.shortcut-box:focus {
  background-color: #2563eb;
  color: white;
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.18);
  outline: none;
}

div.shortcut-box span.icon {
  font-size: 1.8rem;
}

/* Widgets */
section.widget {
  background-color: #fff;
  border-radius: 10px;
  padding: 1.2rem 1.5rem;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.1);
  margin-bottom: 1.6rem;
}

section.widget h2 {
  margin-top: 0;
  margin-bottom: 0.8rem;
  font-size: 1.25rem;
  color: #1e293b;
}

section.widget ul {
  list-style: none;
  padding-left: 0;
  margin: 0;
}

section.widget ul li {
  padding: 0.5rem 0;
  border-bottom: 1px solid #e5e7eb;
  font-size: 1rem;
  color: #2563eb;
}

section.widget ul li:last-child {
  border-bottom: none;
}

/* Links inside widgets for counts */
.widget-link {
  color: #2563eb;
  text-decoration: none;
  font-weight: 600;
}

.widget-link:hover,
.widget-link:focus {
  text-decoration: underline;
  outline: none;
  color: #1d4ed8;
}

/* --- Dashboard Only: Responsive Wide Table For Stock Status Widget --- */
.widget-table-wrap {
  width: 100%;
  overflow-x: auto;
  background: #f5f6fa;
  border-radius: 8px;
  box-shadow: 0 2px 5px #0001;
}
.widget-table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
  font-size: 0.93rem;
}
.widget-table thead th {
  background: #f1f5f9;
  color: #2563eb;
  font-weight: bold;
  padding: 7px 4px;
  border-bottom: 1px solid #dbeafe;
  white-space: nowrap;
}
.widget-table tbody td {
  background: #fff;
  padding: 7px 4px;
  border-bottom: 1px solid #f3f4f6;
}
.widget-table tbody tr:hover {
  background: #e0e7ff;
}
.widget-table tfoot td {
  background: #f8fafc;
  font-weight: bold;
  padding: 8px 4px;
  border-top: 1px solid #e2e8f0;
}
@media (max-width: 600px) {
  .widget-table-wrap { border-radius: 0; }
  .widget-table { font-size: 0.83rem; min-width: 400px; }
  section.widget { padding: 0.7rem 0.1rem; }
}

.dashboard-stock-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75em;
  padding-bottom: 2px;
}

.stock-card {
  flex: 1 1 220px;
  min-width: 170px;
  max-width: 325px;
  background: #f8fafc;
  border-radius: 8px;
  box-shadow: 0 1.5px 4px #0001;
  padding: 1em 1em 0.7em;
  margin: 0.2em 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border: 1px solid #e0e7ef;
}

.stock-card.grand-total-card {
  background: #ede9fe;
  color: #4f46e5;
  font-weight: bold;
  border: 1px solid #c7d2fe;
}

.stock-main-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 1.04em;
  margin-bottom: 0.3em;
  gap: 0.5em;
}
.stock-sku { font-weight: bold; color: #1e293b; }
.stock-location { color: #0369a1; font-weight: 600; }
.stock-qty { color: #2563eb; font-size: 1.08em; font-weight: 700; }
.stock-meta-row {
  margin-top: 2px;
  display: flex;
  justify-content: space-between;
  font-size: 0.97em;
  color: #475569;
  gap: 0.5em;
}
.stock-total-kg { font-weight: 500; }
.stock-pct { color: #7c3aed; font-weight: 600; }

@media (max-width: 600px) {
  .dashboard-stock-cards {
    flex-direction: column;
    gap: 0.48em;
    margin-left: -2px;
    margin-right: -2px;
  }
  .stock-card { 
    border-radius: 6px; 
    box-shadow: 0 1px 2.5px #0001;
    padding: 0.75em 0.5em;
    min-width: 90px;
    max-width: 100%;
  }
}

.dashboard-stock-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85em;
}
.stock-card {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 1px 3px #0002;
  border: 1px solid #e0e7ef;
  margin: 0.08em 0;
  padding: 1em 1em 0.7em;
  min-width: 160px;
  max-width: 330px;
  flex: 1 1 205px;
  display: flex;
  flex-direction: column;
  gap: 0.12em;
}
.stock-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2px;
  font-size: 0.97em;
}
.stock-label {
  font-weight: bold;
  color: #334155;
  font-size: 1.08em;
}
.stock-location {
  color: #0369a1;
  font-weight: 600;
  margin-left: 0.8em;
}
.stock-val {
  font-weight: bold;
  color: #1d4ed8;
  margin-left: 0.25em;
}
.stock-percent {
  font-weight: bold;
  color: #a21caf;
  margin-left: 0.25em;
}
.label {
  color: #64748b;
  font-size: 0.97em;
}
.grand-total-card {
  background: #f3f4f6;
  color: #4f46e5;
  font-weight: bold;
  margin-top: 0.6em;
}
@media (max-width: 600px) {
  .dashboard-stock-cards { flex-direction: column; gap: 0.5em;}
  .stock-card { min-width:90px; max-width:98vw; padding: 0.95em 0.4em;}
}

.dashboard-stock-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 1em;
  margin-top:1em;
}
.stock-card {
  flex: 1 1 195px;
  min-width: 150px;
  max-width: 330px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 1px 3px #0002;
  border: 1px solid #e0e7ef;
  margin: 0.08em 0;
  padding: 0.8em 1em 0.8em 1em;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.18em;
}
.stock-card-row {
  width: 100%; display: flex;
  justify-content: space-between;
  font-weight: bold;
  font-size: 1.06em;
  margin-bottom: 0.25em;
}
.stock-sku { color: #0f172a; }
.stock-location { color: #0369a1; font-weight: 600;}
.stock-detail-row {
  width: 100%; display: flex;
  justify-content: space-between;
  color: #475569;
  font-size: 0.99em;
  margin-bottom: 0.18em;
}
.stock-qty { color: #2563eb; font-weight: 600;}
.stock-total { font-weight: 600; }
.stock-percent-row { width: 100%; text-align: right;}
.stock-pct { color: #a21caf; font-weight: 600; font-size:0.98em;}
.stock-total-card {
  background: #f3f4f6;
  color: #4f46e5;
  font-weight: bold;
  border: 1px solid #c7d2fe;
  align-items:center;
  margin-top:1em;
}
@media (max-width:600px){
  .dashboard-stock-cards {flex-direction:column; gap:0.67em;}
  .stock-card { min-width: 90px; max-width: 98vw; }
}
