:root {
  --navy: #1b2a4a;
  --gold: #c9a227;
  --light: #f4f4f4;
  --border: #e0e0e0;
  --text: #222;
  --gray: #6b6b6b;
  --danger: #b3261e;
  --success: #1e7d32;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Arial, sans-serif;
  color: var(--text);
  background: #fafafa;
}
a { color: var(--navy); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  background: var(--navy);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}
.brand { font-weight: 800; font-size: 1.3rem; letter-spacing: 1px; }
.brand span { color: var(--gold); }
.topbar nav a {
  color: #fff;
  margin-right: 1.4rem;
  font-size: 0.95rem;
  opacity: 0.85;
}
.topbar nav a.active, .topbar nav a:hover { opacity: 1; text-decoration: none; border-bottom: 2px solid var(--gold); }
.user-menu { font-size: 0.9rem; color: #ddd; display: flex; gap: 1rem; align-items: center; }
.user-menu a { color: var(--gold); }

.container { max-width: 1100px; margin: 0 auto; padding: 2rem 1.5rem 4rem; }

h1 { font-size: 1.8rem; color: var(--navy); margin-bottom: 0.3rem; }
h2 { font-size: 1.3rem; color: var(--navy); }
.subtitle { color: var(--gray); margin-top: 0; margin-bottom: 1.5rem; }

.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 0.6rem 0.7rem; border-bottom: 1px solid var(--border); font-size: 0.93rem; }
th { color: var(--gray); font-weight: 600; text-transform: uppercase; font-size: 0.75rem; letter-spacing: 0.5px; }
tr:hover { background: #fbfbfb; }
td.num, th.num { text-align: right; }

.btn {
  display: inline-block;
  background: var(--navy);
  color: #fff;
  padding: 0.6rem 1.2rem;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.95rem;
  text-decoration: none;
}
.btn:hover { background: #263a63; text-decoration: none; }
.btn-gold { background: var(--gold); color: #1b1b1b; }
.btn-gold:hover { background: #b8931f; }
.btn-outline { background: #fff; color: var(--navy); border: 1px solid var(--navy); }
.btn-outline:hover { background: var(--light); }
.btn-danger { background: #fff; color: var(--danger); border: 1px solid var(--danger); }
.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.82rem; }

.badge { display: inline-block; padding: 0.2rem 0.6rem; border-radius: 20px; font-size: 0.75rem; font-weight: 600; }
.badge.draft { background: #eee; color: #555; }
.badge.sent { background: #e3edff; color: #1a4fbf; }
.badge.approved { background: #e3f6e6; color: var(--success); }
.badge.rejected { background: #fdeaea; color: var(--danger); }

label { display: block; font-size: 0.85rem; font-weight: 600; color: var(--navy); margin-bottom: 0.3rem; margin-top: 1rem; }
input[type=text], input[type=number], input[type=date], input[type=password], input[type=email], select, textarea {
  width: 100%;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.95rem;
  font-family: inherit;
}
textarea { resize: vertical; }
.form-row { display: flex; gap: 1.2rem; flex-wrap: wrap; }
.form-row > div { flex: 1; min-width: 180px; }

.login-wrap { max-width: 380px; margin: 8rem auto; }
.login-wrap .card { text-align: center; }
.login-wrap h1 { margin-bottom: 1.5rem; }

.alert { padding: 0.8rem 1rem; border-radius: 6px; margin-bottom: 1.2rem; font-size: 0.92rem; }
.alert-error { background: #fdeaea; color: var(--danger); border: 1px solid #f2c1c1; }
.alert-success { background: #e3f6e6; color: var(--success); border: 1px solid #b9e3c0; }
.alert-info { background: #eef3fb; color: var(--navy); border: 1px solid #c9d8f0; }

.item-row { display: grid; grid-template-columns: 70px 2fr 90px 120px 120px 40px; gap: 0.8rem; align-items: center; padding: 0.7rem 0; border-bottom: 1px solid var(--border); }
.item-row img { width: 60px; height: 60px; object-fit: cover; border-radius: 4px; border: 1px solid var(--border); background: #f0f0f0; }
.item-row .no-img { width: 60px; height: 60px; border-radius: 4px; border: 1px dashed var(--border); display: flex; align-items: center; justify-content: center; font-size: 0.65rem; color: #aaa; text-align: center; }

.totals-box { max-width: 420px; margin-left: auto; margin-top: 1.5rem; }
.totals-box .line { display: flex; justify-content: space-between; padding: 0.4rem 0; font-size: 0.95rem; }
.totals-box .line.grand { border-top: 2px solid var(--navy); margin-top: 0.5rem; padding-top: 0.7rem; font-size: 1.25rem; font-weight: 800; color: var(--navy); }

.thumb-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 0.9rem; }
.thumb-picker .product-card { border: 1px solid var(--border); border-radius: 8px; padding: 0.6rem; cursor: pointer; text-align: center; background: #fff; }
.thumb-picker .product-card:hover { border-color: var(--gold); }
.thumb-picker img { width: 100%; height: 90px; object-fit: cover; border-radius: 4px; background: #f0f0f0; }
.thumb-picker .pname { font-size: 0.8rem; margin-top: 0.4rem; font-weight: 600; }
.thumb-picker .pprice { font-size: 0.78rem; color: var(--gray); }

.site-footer { text-align: center; color: var(--gray); font-size: 0.82rem; padding: 2rem 0; }

.mapping-table th, .mapping-table td { font-size: 0.82rem; padding: 0.35rem 0.5rem; white-space: nowrap; }
.mapping-table { display: block; overflow-x: auto; }
