:root {
  --navy: #122D5C;
  --navy-dark: #0B1E13;
  --green: #16A34A;
  --green-dark: #138B3C;
  --amber: #F59E0B;
  --bg: #F4FAF6;
  --surface: #FFFFFF;
  --border: #D3E9D9;
  --text: #1A2E1F;
  --text-muted: #556B5E;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}

a { color: var(--green-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Auth screen */
.auth-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(160deg, var(--navy-dark) 0%, var(--navy) 55%, var(--green-dark) 100%);
}
.auth-card {
  background: var(--surface);
  padding: 2.5rem;
  border-radius: var(--radius);
  width: 340px;
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
}
.auth-card h1 { margin: 0 0 .1rem; font-size: 1.4rem; }
.auth-subtitle { margin: 0 0 1.5rem; color: var(--text-muted); font-size: .9rem; }
.auth-card label { display: block; margin-bottom: 1rem; font-size: .85rem; font-weight: 600; }
.auth-card input {
  display: block; width: 100%; margin-top: .35rem; padding: .6rem .7rem;
  border: 1px solid var(--border); border-radius: 6px; font-size: .95rem;
}
.auth-card button {
  width: 100%; padding: .7rem; background: var(--green); color: #fff; border: none;
  border-radius: 6px; font-weight: 700; font-size: .95rem; cursor: pointer;
}
.auth-card button:hover { background: var(--green-dark); }

/* App shell */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px; flex-shrink: 0; background: var(--navy-dark);
  color: #fff; display: flex; flex-direction: column; padding: 1.5rem 1rem;
}
.brand { font-weight: 800; font-size: 1.1rem; margin-bottom: 2rem; }
.brand span { display: block; font-weight: 400; font-size: .75rem; color: var(--amber); letter-spacing: .05em; }
.sidebar nav { display: flex; flex-direction: column; gap: .25rem; flex: 1; }
.sidebar nav a {
  color: rgba(255,255,255,.75); padding: .6rem .75rem; border-radius: 6px; font-size: .9rem; font-weight: 600;
}
.sidebar nav a:hover { background: rgba(255,255,255,.08); text-decoration: none; color: #fff; }
.sidebar nav a.active { background: var(--green); color: #fff; }
.sidebar-footer { font-size: .8rem; color: rgba(255,255,255,.6); border-top: 1px solid rgba(255,255,255,.12); padding-top: 1rem; }
.sidebar-footer span { display: block; margin-bottom: .4rem; color: #fff; }
.sidebar-footer a { color: var(--amber); font-weight: 600; }

.content { flex: 1; padding: 2rem 2.5rem; max-width: 1200px; }
.content-header { display: flex; align-items: baseline; gap: .75rem; margin-bottom: 1.5rem; }
.content-header h1 { margin: 0; font-size: 1.5rem; }
.content-header-meta { color: var(--text-muted); font-size: .9rem; }

.alert { padding: .75rem 1rem; border-radius: 8px; font-size: .9rem; margin-bottom: 1.25rem; }
.alert-info { background: #E8F5EC; color: var(--green-dark); border: 1px solid var(--border); }
.alert-error { background: #FEE2E2; color: #B91C1C; border: 1px solid #FCA5A5; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; }
.stat-value { display: block; font-size: 1.6rem; font-weight: 800; color: var(--navy); }
.stat-label { font-size: .8rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }

.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; margin-bottom: 1.5rem; }
.panel h2 { margin-top: 0; font-size: 1.05rem; }

.brand-list { list-style: none; margin: 0; padding: 0; }
.brand-list li { display: flex; justify-content: space-between; padding: .5rem 0; border-bottom: 1px solid var(--border); font-size: .9rem; }
.brand-list li:last-child { border-bottom: none; }

.empty-state { color: var(--text-muted); font-style: italic; }

.filter-bar { display: flex; gap: .6rem; margin-bottom: 1.5rem; }
.filter-bar input, .filter-bar select {
  padding: .55rem .7rem; border: 1px solid var(--border); border-radius: 6px; font-size: .9rem;
}
.filter-bar input { flex: 1; }
.filter-bar button, section.panel button, .button {
  padding: .55rem 1.1rem; background: var(--green); color: #fff; border: none;
  border-radius: 6px; font-weight: 700; cursor: pointer; font-size: .9rem;
}
.filter-bar button:hover, section.panel button:hover { background: var(--green-dark); }
section.panel button:disabled { background: #9CA3AF; cursor: not-allowed; }
.button-secondary { display: inline-block; background: var(--navy); margin: 1rem 0; }
.button-secondary:hover { background: var(--navy-dark); text-decoration: none; }

.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 1rem; }
.product-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: .9rem; display: block; color: var(--text); transition: box-shadow .15s, transform .15s;
}
.product-card:hover { box-shadow: 0 8px 24px rgba(19,139,60,.15); transform: translateY(-2px); text-decoration: none; }
.product-thumb { height: 130px; display: flex; align-items: center; justify-content: center; margin-bottom: .6rem; background: #F8FBF9; border-radius: 6px; }
.product-thumb img { max-width: 100%; max-height: 100%; object-fit: contain; }
.product-card-source {
  font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em;
  color: var(--navy); margin-top: .2rem;
}
.product-card-name { font-weight: 700; font-size: .85rem; line-height: 1.3; margin-bottom: .2rem; }
.product-card-brand { font-size: .75rem; color: var(--text-muted); }
.product-card-price { font-size: .8rem; font-weight: 700; color: var(--green-dark); margin-top: .4rem; }
.product-card-stock { font-size: .7rem; color: var(--text-muted); margin-top: .15rem; }

.pager { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem; margin-top: 1.5rem; }
.pager a { padding: .4rem .75rem; border: 1px solid var(--border); border-radius: 6px; font-size: .85rem; color: var(--text); background: var(--surface); }
.pager a:hover { border-color: var(--green); text-decoration: none; }
.pager a.active { background: var(--green); color: #fff; border-color: var(--green); font-weight: 700; }
.pager a.pager-nav { font-weight: 700; }
.pager a.disabled { opacity: .35; pointer-events: none; }
.pager-ellipsis { padding: .4rem .3rem; color: var(--text-muted); }

.back-link { display: inline-block; margin-bottom: 1rem; font-size: .9rem; }

.product-detail { display: grid; grid-template-columns: 380px 1fr; gap: 2.5rem; }
.gallery-main { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); height: 320px; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.gallery-main img { max-width: 100%; max-height: 100%; object-fit: contain; }
.gallery-main--empty { color: var(--text-muted); }
.gallery-thumbs { display: flex; gap: .5rem; margin-top: .6rem; flex-wrap: wrap; }
.gallery-thumbs img { width: 56px; height: 56px; object-fit: contain; border: 1px solid var(--border); border-radius: 6px; background: #fff; cursor: pointer; padding: 4px; }

.product-detail-brand { color: var(--green-dark); font-weight: 700; font-size: .85rem; margin: 0; }
.product-detail-info h1 { margin: .1rem 0 .3rem; font-size: 1.4rem; }
.product-detail-category { color: var(--text-muted); font-size: .85rem; margin: 0 0 .8rem; }
.product-detail-price { font-size: 1.2rem; font-weight: 800; color: var(--navy); }
.product-detail-stock { font-size: .8rem; color: var(--green-dark); font-weight: 600; margin: .2rem 0 0; }

.meta-list { display: grid; grid-template-columns: auto 1fr; gap: .3rem 1rem; font-size: .85rem; margin: 1rem 0; }
.meta-list dt { color: var(--text-muted); }
.meta-list dd { margin: 0; font-weight: 600; }

.specs-table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.specs-table th, .specs-table td { text-align: left; padding: .5rem; border-bottom: 1px solid var(--border); }
.specs-table th { width: 40%; color: var(--text-muted); font-weight: 600; }

.progress-block { margin-top: 1.25rem; }
.progress-bar { height: 10px; background: var(--border); border-radius: 99px; overflow: hidden; }
.progress-bar-fill { height: 100%; background: var(--green); transition: width .4s ease; }
.progress-label { font-size: .8rem; color: var(--text-muted); margin: .5rem 0 0; }

.runs-table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.runs-table th, .runs-table td { text-align: left; padding: .5rem .6rem; border-bottom: 1px solid var(--border); }
.runs-table th { color: var(--text-muted); font-weight: 600; }

.badge { padding: .15rem .55rem; border-radius: 99px; font-size: .75rem; font-weight: 700; }
.badge-ok { background: #D1FAE5; color: var(--green-dark); }
.badge-running { background: #FEF3C7; color: #92400E; }
.badge-error { background: #FEE2E2; color: #B91C1C; }

@media (max-width: 820px) {
  .app-shell { flex-direction: column; }
  .sidebar { width: 100%; flex-direction: row; align-items: center; padding: 1rem; }
  .sidebar nav { flex-direction: row; }
  .sidebar-footer { display: none; }
  .content { padding: 1.25rem; }
  .product-detail { grid-template-columns: 1fr; }
}
