/* ============================================================
   Formal Leather Analytics — stylesheet
   Palette: espresso brown sidebar, cream canvas, cognac accent
   ============================================================ */

:root {
  --bg: #f6f1ea;
  --card: #ffffff;
  --ink: #241a12;
  --muted: #8a7a6b;
  --line: #e8ddcf;
  --brand: #2e2018;
  --brand-2: #453023;
  --accent: #b57a3e;
  --accent-soft: #f3e5d5;
  --green: #2e7d4f;
  --green-soft: #e4f2ea;
  --red: #b3402f;
  --red-soft: #f9e7e3;
  --amber: #9a6b1f;
  --amber-soft: #f7eed9;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(36, 26, 18, 0.07), 0 6px 18px rgba(36, 26, 18, 0.05);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans Bengali", sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14.5px;
  line-height: 1.5;
  display: flex;
  min-height: 100vh;
}

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

/* ---------------- sidebar ---------------- */

.sidebar {
  width: 232px;
  min-width: 232px;
  background: linear-gradient(180deg, #2e2018 0%, #241a12 100%);
  color: #efe6da;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 22px 20px 18px;
  border-bottom: 1px solid rgba(239, 230, 218, 0.12);
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 700;
  font-size: 19px;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0.5px;
}

.brand-name {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 17px;
  line-height: 1.15;
  letter-spacing: 0.4px;
}

.brand-name span { display: block; color: var(--accent); }

.nav { flex: 1; padding: 14px 10px; overflow-y: auto; }

.nav a {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  margin-bottom: 2px;
  border-radius: 9px;
  color: #d8cbbb;
  font-size: 13.5px;
  text-decoration: none;
}

.nav a .ico { width: 20px; text-align: center; font-size: 15px; }

.nav a:hover { background: rgba(239, 230, 218, 0.08); color: #fff; text-decoration: none; }

.nav a.active {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}

.sidebar-foot {
  padding: 14px 20px;
  border-top: 1px solid rgba(239, 230, 218, 0.12);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12.5px;
  color: #b8a995;
}

.sidebar-foot .who { color: #cbbdae; }
.sidebar-foot a { color: var(--accent); }

/* ---------------- main ---------------- */

.main { flex: 1; padding: 26px 30px 60px; min-width: 0; }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 20px;
  gap: 12px;
  flex-wrap: wrap;
}

.topbar h1 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

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

/* ---------------- cards / layout ---------------- */

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 20px;
}

.card h2 {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 14px;
  letter-spacing: 0.2px;
}

.card .sub { color: var(--muted); font-size: 12.5px; margin-top: -10px; margin-bottom: 14px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.grid-3 { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; align-items: start; }

/* ---------------- stat tiles ---------------- */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}

.stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 15px 17px;
}

.stat .label {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--muted);
  margin-bottom: 6px;
}

.stat .value { font-size: 21px; font-weight: 700; letter-spacing: 0.2px; }
.stat .value.pos { color: var(--green); }
.stat .value.neg { color: var(--red); }
.stat .hint { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* ---------------- tables ---------------- */

.tblwrap { overflow-x: auto; }

table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }

.tbl th {
  text-align: left;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--muted);
  font-weight: 600;
  padding: 8px 10px;
  border-bottom: 2px solid var(--line);
  white-space: nowrap;
}

.tbl td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.tbl tr:last-child td { border-bottom: none; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl th.num { text-align: right; }
.tbl .strong { font-weight: 700; }
.tbl tfoot td { font-weight: 700; border-top: 2px solid var(--line); }

.prod-cell { display: flex; align-items: center; gap: 10px; min-width: 180px; }
.prod-cell img { width: 36px; height: 36px; border-radius: 7px; object-fit: cover; border: 1px solid var(--line); background: var(--accent-soft); }
.prod-cell .pc-name { font-weight: 600; line-height: 1.25; }
.prod-cell .pc-sku { font-size: 11.5px; color: var(--muted); }

/* ---------------- forms ---------------- */

.field { margin-bottom: 13px; }

.field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

input[type="text"], input[type="password"], input[type="number"],
input[type="date"], input[type="month"], input[type="url"], select, textarea {
  width: 100%;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 13.5px;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(181, 122, 62, 0.15);
}

input.in-sm { padding: 6px 8px; font-size: 13px; }

.form-row { display: flex; gap: 12px; flex-wrap: wrap; }
.form-row .field { flex: 1; min-width: 130px; }

.check { display: flex; align-items: center; gap: 8px; font-size: 13.5px; }
.check input { width: auto; }

/* ---------------- buttons ---------------- */

.btn {
  display: inline-block;
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
}

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

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

.btn-accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-accent:hover { background: #9c6832; border-color: #9c6832; color: #fff; }

.btn-danger { background: none; border: none; color: var(--red); font-size: 12.5px; font-weight: 600; cursor: pointer; padding: 4px 6px; }
.btn-danger:hover { text-decoration: underline; }

.btn-sm { padding: 5px 11px; font-size: 12.5px; }

/* ---------------- badges / flash / tabs ---------------- */

.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.badge-green { background: var(--green-soft); color: var(--green); }
.badge-red { background: var(--red-soft); color: var(--red); }
.badge-amber { background: var(--amber-soft); color: var(--amber); }
.badge-neutral { background: var(--accent-soft); color: #7a5a37; }

.flash {
  padding: 11px 15px;
  border-radius: 9px;
  margin-bottom: 18px;
  font-size: 13.5px;
  font-weight: 600;
}

.flash-ok { background: var(--green-soft); color: var(--green); border: 1px solid #c4e3d2; }
.flash-err { background: var(--red-soft); color: var(--red); border: 1px solid #eccfc8; }
.flash-warn { background: var(--amber-soft); color: var(--amber); border: 1px solid #ecdcb6; }

.tabs { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }

.tabs a {
  padding: 7px 15px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}

.tabs a:hover { border-color: var(--accent); text-decoration: none; }
.tabs a.active { background: var(--brand); border-color: var(--brand); color: #fff; }

.empty {
  text-align: center;
  color: var(--muted);
  padding: 30px 10px;
  font-size: 13.5px;
}

.note-box {
  background: var(--accent-soft);
  border: 1px solid #e6d2b8;
  border-radius: 9px;
  padding: 12px 15px;
  font-size: 13px;
  color: #6d4f2e;
  margin-bottom: 18px;
}

details.rowitems summary { cursor: pointer; color: var(--accent); font-size: 12.5px; font-weight: 600; }
details.rowitems { margin-top: 4px; }
details.rowitems ul { margin: 6px 0 0 18px; color: var(--muted); font-size: 12.5px; }

/* ---------------- login ---------------- */

.auth-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: var(--bg); width: 100%; }

.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 34px 32px;
  margin: 20px;
}

.auth-brand { text-align: center; margin-bottom: 24px; }

.auth-brand .brand-mark { margin: 0 auto 12px; width: 52px; height: 52px; font-size: 23px; }

.auth-brand h1 { font-family: Georgia, "Times New Roman", serif; font-size: 22px; }
.auth-brand p { color: var(--muted); font-size: 13px; margin-top: 3px; }

/* ---------------- charts ---------------- */

.chart-box { position: relative; height: 280px; }
.chart-box-sm { position: relative; height: 240px; }

/* ---------------- responsive ---------------- */

@media (max-width: 980px) {
  body { flex-direction: column; }

  .sidebar {
    width: 100%;
    min-width: 0;
    height: auto;
    position: static;
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    padding: 4px 8px;
  }

  .brand { border-bottom: none; padding: 10px 12px; }
  .brand-name { display: none; }

  .nav { display: flex; overflow-x: auto; padding: 6px 4px; }
  .nav a { white-space: nowrap; padding: 7px 10px; }
  .nav a .ico { display: none; }

  .sidebar-foot { border-top: none; margin-left: auto; padding: 8px 12px; }

  .main { padding: 18px 14px 50px; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .stat-grid { grid-template-columns: 1fr; }
}
