:root {
  --blue: #2ca01c;
  --dark: #1a2b3c;
  --border: #dde3e8;
  --bg: #f4f6f8;
  --text: #2b3a42;
  --muted: #68787f;
  --danger: #c0392b;
  --red: #b00020;
}

* { box-sizing: border-box; }

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

a { color: #1565c0; text-decoration: none; }
a:hover { text-decoration: underline; }

.topnav {
  background: var(--dark);
  color: white;
  position: sticky;
  top: 0;
  z-index: 10;
}
.topnav-inner {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 10px 20px;
  max-width: 1280px;
  margin: 0 auto;
}
.brand { color: white; font-weight: 700; font-size: 18px; }
.topnav nav { display: flex; gap: 16px; flex: 1; align-items: center; }
.topnav nav a { color: #cfd8dc; font-size: 13px; padding: 6px 2px; }
.topnav nav a.active, .topnav nav a:hover { color: white; border-bottom: 2px solid var(--blue); text-decoration: none; }
.nav-user { font-size: 12px; color: #cfd8dc; display: flex; align-items: center; gap: 10px; }

.dropdown { position: relative; }
.dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: white;
  border: 1px solid var(--border);
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  min-width: 180px;
  padding: 6px 0;
  z-index: 20;
}
.dropdown:hover .dropdown-menu { display: block; }
.dropdown-menu a { display: block; padding: 8px 14px; color: var(--text); font-size: 13px; }
.dropdown-menu a:hover { background: var(--bg); text-decoration: none; }

.container { max-width: 1280px; margin: 0 auto; padding: 20px; }

h1 { font-size: 22px; margin: 10px 0 16px; }
h2 { font-size: 16px; margin: 0 0 10px; color: var(--dark); }

.page-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; }
.actions { display: flex; gap: 8px; }

.card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 16px 18px;
  margin-bottom: 18px;
}
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { text-align: left; }
.stat-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 6px; }
.stat-value { font-size: 22px; font-weight: 700; }
.positive { color: var(--blue); }
.negative { color: var(--red); }

.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: left; }
.table thead th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; border-bottom: 2px solid var(--border); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table tr.inactive { opacity: 0.5; }
.subtotal-row td { font-weight: 600; border-top: 2px solid var(--border); }
.grand-total-row td { font-weight: 700; font-size: 15px; border-top: 2px solid var(--dark); }
.grand-total-row-card { font-size: 15px; }
.empty { color: var(--muted); text-align: center; padding: 20px !important; }
.note { color: var(--muted); font-size: 13px; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; text-transform: uppercase; background: #e0e0e0; color: #444; }
.badge-posted { background: #d7f2cf; color: #216e1a; }
.badge-draft { background: #fff3c4; color: #8a6d00; }
.badge-reversed { background: #f0d0d0; color: #7d1f1f; }
.badge-pending { background: #fff3c4; color: #8a6d00; }
.badge-discarded { background: #e0e0e0; color: #666; }

form label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); margin-right: 8px; }
input, select, button {
  font-family: inherit;
  font-size: 13px;
}
input[type=text], input[type=date], input[type=month], input[type=number], input[type=password], select {
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: 4px;
  min-height: 32px;
}
.num-input { text-align: right; max-width: 110px; }

.inline-form { display: flex; align-items: end; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.form-row { display: flex; gap: 14px; margin-bottom: 12px; flex-wrap: wrap; }

.btn {
  display: inline-block;
  padding: 8px 14px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: white;
  color: var(--text);
  cursor: pointer;
  font-size: 13px;
  text-decoration: none;
}
.btn:hover { background: var(--bg); }
.btn-primary { background: var(--blue); color: white; border-color: var(--blue); }
.btn-primary:hover { background: #258717; }
.btn-primary:disabled { background: #a5c9a0; border-color: #a5c9a0; cursor: not-allowed; }
.btn-danger { color: var(--danger); border-color: var(--danger); background: white; }
.btn-danger:hover { background: #fbeaea; }
.link-btn { background: none; border: none; color: #1565c0; cursor: pointer; padding: 0; font-size: 14px; }
.checkbox-btn { background: none; border: none; cursor: pointer; font-size: 16px; }

.login-box {
  max-width: 340px;
  margin: 80px auto;
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 30px;
  text-align: center;
}
.login-box h1 { color: var(--blue); }
.login-box form { display: flex; flex-direction: column; gap: 14px; margin-top: 16px; }
.login-box label { text-align: left; }

.alert { padding: 10px 14px; border-radius: 4px; margin-bottom: 14px; font-size: 13px; }
.alert-error { background: #fbeaea; color: var(--danger); border: 1px solid #f0bcbc; }

.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; }

.totals-bar { display: flex; gap: 20px; align-items: center; margin: 14px 0; font-size: 14px; }

.attachment-list { list-style: none; padding: 0; margin: 0 0 12px; }
.attachment-list li { padding: 4px 0; }

.report-range { color: var(--muted); font-size: 13px; margin: -4px 0 14px; }
.col-label { color: var(--muted); font-size: 11px; }

@media print {
  .no-print { display: none !important; }
  body { background: white; }
  .card { border: none; padding: 0; margin-bottom: 14px; }
  .container { padding: 0; max-width: 100%; }
}
