/* IMS: Inventory Management System (flat UI) */

:root {
  --bg: #f4f3ef;
  --bg-top: #faf9f6;
  --surface: #ffffff;
  --text: #141414;
  --muted: #5c5c5c;
  --border: #d4d2cd;
  --accent: #0d6b58;
  --accent-hover: #0a5546;
  --accent-soft: rgba(13, 107, 88, 0.08);
  --danger: #b42318;
  --focus: #2563eb;
  --radius: 8px;
  --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --space: 1rem;
  --max: 60rem;
}

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

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  line-height: 1.55;
  color: var(--text);
  background: linear-gradient(180deg, var(--bg-top) 0%, var(--bg) 38rem);
  background-color: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.skip-link {
  position: absolute;
  left: -9999px;
  z-index: 999;
  padding: 0.5rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
}
.skip-link:focus {
  left: var(--space);
  top: var(--space);
}

h1,
h2,
h3 {
  font-weight: 600;
  line-height: 1.2;
  margin: 0 0 0.5rem;
}

h1 {
  font-size: 1.75rem;
  letter-spacing: -0.02em;
}

h2 {
  font-size: 1.125rem;
}

h3 {
  font-size: 1rem;
}

p {
  margin: 0 0 var(--space);
}

p:last-child {
  margin-bottom: 0;
}

.muted {
  color: var(--muted);
  font-size: 0.9375rem;
}

.small {
  font-size: 0.8125rem;
}

code {
  font-size: 0.9em;
  background: #eee;
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

/* Header */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.site-header__inner {
  max-width: calc(var(--max) + 4rem);
  margin: 0 auto;
  padding: 0.85rem var(--space);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 1.5rem;
}

.site-brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  text-decoration: none;
  color: inherit;
  min-width: 0;
}

@media (min-width: 720px) {
  .site-brand {
    flex-direction: row;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.35rem 0.65rem;
  }
}

.site-brand__mark {
  font-family: var(--font-serif);
  font-size: 1.4rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--text);
  line-height: 1;
}

.site-brand__full {
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  line-height: 1.35;
  max-width: 16rem;
}

@media (min-width: 720px) {
  .site-brand__full {
    max-width: none;
    padding-left: 0.65rem;
    border-left: 1px solid var(--border);
    font-size: 0.8125rem;
  }
}

.site-brand:hover .site-brand__mark {
  color: var(--accent);
}

.site-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
}

.site-nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9375rem;
  padding: 0.35rem 0.15rem;
  margin: -0.35rem -0.15rem;
  border-radius: 4px;
  border-bottom: 2px solid transparent;
}

.site-nav a:hover {
  color: var(--text);
  background: var(--accent-soft);
}

.site-nav a:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 2px;
}

.site-nav a.is-active {
  color: var(--text);
  font-weight: 600;
  border-bottom-color: var(--accent);
}

/* Main */
.main {
  flex: 1;
  width: 100%;
  max-width: calc(var(--max) + 4rem);
  margin: 0 auto;
  padding: 1.5rem var(--space) 3rem;
}

.page-intro {
  margin-bottom: 1.75rem;
  padding: 0.15rem 0 0.15rem 0.85rem;
  border-left: 3px solid var(--accent);
}

.page-intro h1 {
  margin-bottom: 0.4rem;
}

.page-intro--row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem 1.5rem;
}

.page-intro--row .btn {
  flex-shrink: 0;
  margin-top: 0.15rem;
}

/* Panels */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.35rem 1.4rem;
  margin-bottom: 1.25rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

@media (prefers-reduced-motion: no-preference) {
  .panel:hover {
    border-color: #c5c1b8;
    box-shadow: 0 8px 24px rgba(20, 20, 20, 0.05);
  }
}

.panel h2 {
  margin-bottom: 0.75rem;
}

.panel__subhead {
  margin-top: 1.5rem;
  margin-bottom: 0.65rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  font-size: 1.125rem;
}

/* Stats */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.15rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

@media (prefers-reduced-motion: no-preference) {
  .stat:hover {
    border-color: #c5c1b8;
    box-shadow: 0 6px 18px rgba(20, 20, 20, 0.04);
  }
}

.stat__value {
  display: block;
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.stat__label {
  font-size: 0.8125rem;
  color: var(--muted);
}

/* Grid */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}

/* Forms */
.stack {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.field label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.35rem;
}

.field input[type="number"],
.field input[type="text"] {
  width: 100%;
  max-width: 20rem;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font: inherit;
  background: var(--surface);
}

.field input:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
}

.dropzone {
  position: relative;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
  background: #fafaf8;
}

.dropzone:focus-within {
  border-color: var(--accent);
  background: var(--surface);
}

.dropzone__input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.dropzone__label {
  pointer-events: none;
  font-size: 0.9375rem;
  color: var(--muted);
}

.dropzone.is-dragover {
  border-color: var(--accent);
  background: rgba(13, 107, 88, 0.06);
}

.file-preview {
  font-size: 0.875rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.55rem 1.1rem;
  font: inherit;
  font-size: 0.9375rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  line-height: 1.25;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.12s ease;
}

@media (prefers-reduced-motion: no-preference) {
  .btn:active {
    transform: scale(0.98);
  }
}

.btn:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}

.btn-secondary:hover {
  border-color: var(--muted);
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* Tables */
.table-wrap {
  overflow-x: auto;
  margin-top: 0.5rem;
}

.table-wrap--tall {
  max-height: 22rem;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.data-table th,
.data-table td {
  text-align: left;
  padding: 0.5rem 0.65rem;
  border-bottom: 1px solid var(--border);
}

.data-table th {
  font-weight: 600;
  color: var(--muted);
  font-size: 0.8125rem;
}

.table-wrap--tall .data-table th {
  position: sticky;
  top: 0;
  background: var(--surface);
  box-shadow: 0 1px 0 var(--border);
  z-index: 1;
}

.data-table tbody tr:hover {
  background: #fafaf8;
}

.tag {
  font-size: 0.75rem;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
}

.tag-bad {
  background: #fde8e6;
  color: var(--danger);
}

/* Chart */
.chart-box {
  height: 280px;
  position: relative;
  margin-top: 0.75rem;
}

/* Prediction */
.model-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
}

.prediction-result {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.prediction-result[hidden] {
  display: none !important;
}

/* Error */
.error-page {
  max-width: 28rem;
}

.error-page__msg {
  color: var(--muted);
  margin-bottom: 1.5rem;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.15rem var(--space);
  margin-top: auto;
  font-size: 0.8125rem;
  color: var(--muted);
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.02));
}

.site-footer__inner {
  max-width: calc(var(--max) + 4rem);
  margin: 0 auto;
}

.site-footer__inner p {
  margin: 0 0 0.35rem;
}

.site-footer__inner p:last-child {
  margin-bottom: 0;
}

.site-footer__tag {
  font-style: italic;
  opacity: 0.92;
}

/* Notifications */
.notification {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 1000;
  max-width: 22rem;
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.notification--error {
  border-color: #f5a8a0;
  background: #fff8f7;
}

.notification--success {
  border-color: #9dd4b8;
  background: #f4fbf7;
}

.notification--info {
  border-color: #c5d4f5;
  background: #f7f9ff;
}
