:root {
  --bg: #f5f7fa;
  --panel: #ffffff;
  --panel-soft: #f8fafc;
  --text: #182230;
  --muted: #64748b;
  --line: #d9e1ea;
  --strong: #0f6b63;
  --strong-dark: #0b514b;
  --accent: #9a5b13;
  --danger: #b91c1c;
  --ok: #15803d;
  --shadow: 0 10px 28px rgba(16, 24, 40, 0.07);
  --focus: 0 0 0 3px rgba(15, 107, 99, 0.18);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--text);
  background:
    linear-gradient(180deg, #f8fafc 0, var(--bg) 260px),
    var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.45;
}

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

button {
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  padding: 0 14px;
  color: #fff;
  background: var(--strong);
  cursor: pointer;
  font-weight: 700;
  transition: background 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

button:hover {
  background: var(--strong-dark);
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

button:active {
  transform: translateY(1px);
}

button.ghost {
  color: var(--text);
  background: #e8eef4;
}

button.ghost:hover {
  background: #dbe4ec;
}

button.warn {
  background: var(--accent);
}

button.danger {
  background: var(--danger);
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px 16px;
  color: #e5edf5;
  background: #17212c;
  overflow: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  color: #fff;
  background: var(--strong);
  font-weight: 800;
  letter-spacing: 0;
}

.brand h1 {
  margin: 0;
  font-size: 17px;
}

.brand p {
  margin: 3px 0 0;
  color: #a7b4c2;
  font-size: 13px;
}

.field {
  display: grid;
  gap: 7px;
  margin-bottom: 12px;
}

.field span {
  color: var(--muted);
  font-size: 13px;
}

.field small {
  color: var(--muted);
  font-size: 12px;
}

.sidebar .field span {
  color: #b6c3d1;
}

input,
select,
textarea {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  color: var(--text);
  background: #fff;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

input:hover,
select:hover,
textarea:hover {
  border-color: #b7c4d2;
}

.date-window-input {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) auto;
  align-items: stretch;
}

.date-window-input input {
  border-radius: 6px 0 0 6px;
}

.date-window-input span {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-left: 0;
  border-radius: 0 6px 6px 0;
  background: var(--panel-soft);
  color: var(--text);
  font-size: 13px;
  white-space: nowrap;
}

textarea {
  min-height: 78px;
  resize: vertical;
}

nav {
  display: grid;
  gap: 6px;
  margin-top: 18px;
}

.nav-button {
  width: 100%;
  justify-content: flex-start;
  color: #d9e3ee;
  background: transparent;
  text-align: left;
  border: 1px solid transparent;
}

.nav-button:hover,
.nav-button.active {
  color: #fff;
  background: #243446;
  border-color: #33475d;
}

.nav-button.active {
  box-shadow: inset 3px 0 0 var(--strong);
}

.sidebar-note {
  display: grid;
  gap: 5px;
  margin-top: 22px;
  padding: 12px;
  border: 1px solid #334255;
  border-radius: 8px;
  color: #c8d5e1;
  font-size: 13px;
}

.main {
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 28px;
  background: rgba(255, 255, 255, 0.86);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}

.top-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

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

.topbar h2 {
  margin: 0;
  font-size: 25px;
}

.content {
  display: grid;
  gap: 18px;
  padding: 24px 28px 42px;
}

.stats-grid,
.form-grid,
.split-grid {
  display: grid;
  gap: 14px;
}

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

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

.split-grid {
  grid-template-columns: minmax(0, 1fr) minmax(340px, 0.65fr);
}

.panel,
.stat,
.table-wrap {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.panel {
  padding: 20px;
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.panel-header h3,
.stat h3 {
  margin: 0;
}

.panel-header p,
.stat p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.stat {
  padding: 16px;
}

.stat h3 {
  color: #334155;
  font-size: 14px;
}

.stat strong {
  display: block;
  margin-top: 10px;
  color: var(--strong-dark);
  font-size: 30px;
  line-height: 1;
}

.table-wrap {
  overflow: auto;
}

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

.split-grid table {
  min-width: 0;
}

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

th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: #344256;
  background: #edf2f7;
  font-size: 13px;
  font-weight: 800;
}

tbody tr:nth-child(even) td {
  background: #fbfdff;
}

tbody tr:hover td {
  background: #f3f8f7;
}

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

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 9px;
  color: #123;
  background: #e2e8f0;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.tag.ok {
  color: #14532d;
  background: #dcfce7;
}

.tag.warn {
  color: #7c2d12;
  background: #ffedd5;
}

.tag.danger {
  color: #7f1d1d;
  background: #fee2e2;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.helper {
  color: var(--muted);
  font-size: 13px;
}

.notice {
  margin: 0 0 14px;
  border-left: 4px solid var(--accent);
  border-radius: 6px;
  padding: 10px 12px;
  color: #7c2d12;
  background: #fff7ed;
  font-size: 14px;
}

.sku {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-weight: 800;
}

.thumb {
  width: 54px;
  height: 54px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-soft);
}

.inline-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr)) auto;
  gap: 10px;
  align-items: end;
}

.inline-form button {
  align-self: end;
  margin-bottom: 12px;
  white-space: nowrap;
}

.empty-state {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 36px;
  color: var(--muted);
  text-align: center;
}

.empty-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  color: #fff;
  background: var(--muted);
  font-weight: 800;
}

.empty-state h3 {
  margin: 0;
  color: var(--text);
}

.empty-state p {
  margin: 0;
}

.hidden {
  display: none !important;
}

.login-page {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
  background:
    radial-gradient(circle at top, rgba(15, 107, 99, 0.10), transparent 32rem),
    var(--bg);
}

.login-card {
  width: min(420px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 26px;
  background: #fff;
  box-shadow: var(--shadow);
}

.public-card {
  width: min(1100px, 100%);
}

.login-links {
  margin: 14px 0;
  font-size: 14px;
}

.login-links a {
  color: var(--strong-dark);
  font-weight: 700;
  text-decoration: none;
}

.login-links a:hover {
  text-decoration: underline;
}

.login-brand {
  color: var(--text);
  margin-bottom: 22px;
}

.login-brand p {
  color: var(--muted);
}

.form-error {
  margin: 0 0 12px;
  color: var(--danger);
  font-size: 14px;
}

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

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

  .stats-grid,
  .form-grid,
  .split-grid {
    grid-template-columns: 1fr;
  }

  .inline-form {
    grid-template-columns: 1fr;
  }
}
