/* BizSys — minimalist */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #f7f7f8;
  color: #1a1a1a;
  font-size: 14px;
  line-height: 1.5;
}
a { color: #0066cc; text-decoration: none; }
a:hover { text-decoration: underline; }

.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 220px;
  background: #ffffff;
  border-right: 1px solid #e5e5e7;
  display: flex;
  flex-direction: column;
  padding: 1.25rem 0;
}
.brand {
  font-weight: 700;
  font-size: 1.05rem;
  padding: 0 1.25rem 1rem;
  border-bottom: 1px solid #eee;
  margin-bottom: .75rem;
}
.sidebar nav { display: flex; flex-direction: column; flex: 1; }
.sidebar nav a {
  padding: .55rem 1.25rem;
  color: #333;
  font-size: .92rem;
  border-left: 3px solid transparent;
}
.sidebar nav a:hover { background: #f2f2f4; text-decoration: none; }
.sidebar nav a.active {
  background: #f2f2f4;
  border-left-color: #1a1a1a;
  font-weight: 600;
}
.user-box {
  border-top: 1px solid #eee;
  padding: 1rem 1.25rem;
  font-size: .85rem;
}
.user-box .logout { display:inline-block; margin-top:.4rem; color:#c0392b; }
.muted { color: #888; font-size: .8rem; }

.main { flex: 1; padding: 1.75rem 2rem; max-width: 100%; overflow-x: auto; }
h1 { font-size: 1.5rem; margin: 0 0 1rem; font-weight: 600; }
h2 { font-size: 1.15rem; margin: 1.5rem 0 .75rem; font-weight: 600; }

.card {
  background: #fff;
  border: 1px solid #e5e5e7;
  border-radius: 6px;
  padding: 1.25rem;
  margin-bottom: 1rem;
}
.grid { display: grid; gap: 1rem; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 800px) {
  .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr 1fr; }
  .sidebar { width: 180px; }
}

.stat { padding: 1rem; background: #fff; border: 1px solid #e5e5e7; border-radius: 6px; }
.stat .label { font-size: .8rem; color: #666; text-transform: uppercase; letter-spacing: .04em; }
.stat .value { font-size: 1.5rem; font-weight: 600; margin-top: .25rem; }

table { width: 100%; border-collapse: collapse; background: #fff; }
th, td { padding: .6rem .75rem; text-align: left; border-bottom: 1px solid #eee; font-size: .9rem; }
th { background: #fafafa; font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: #555; }
tr:hover td { background: #fafbfc; }
td.right, th.right { text-align: right; }
td.center, th.center { text-align: center; }

.btn {
  display: inline-block;
  padding: .5rem 1rem;
  background: #1a1a1a;
  color: #fff;
  border: 1px solid #1a1a1a;
  border-radius: 5px;
  cursor: pointer;
  font-size: .88rem;
  font-family: inherit;
}
.btn:hover { background: #333; text-decoration: none; color:#fff; }
.btn-secondary { background: #fff; color: #1a1a1a; }
.btn-secondary:hover { background: #f2f2f4; color: #1a1a1a; }
.btn-danger { background: #c0392b; border-color: #c0392b; }
.btn-danger:hover { background: #a83224; }
.btn-sm { padding: .3rem .6rem; font-size: .8rem; }

input[type=text], input[type=number], input[type=email], input[type=password], input[type=date], input[type=search], select, textarea {
  width: 100%;
  padding: .5rem .65rem;
  border: 1px solid #d5d5d8;
  border-radius: 5px;
  font-size: .9rem;
  font-family: inherit;
  background: #fff;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: #1a1a1a; }
label { display: block; font-size: .82rem; margin: .5rem 0 .25rem; color: #444; font-weight: 500; }
.form-row { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }

.flash { padding: .7rem 1rem; border-radius: 5px; margin-bottom: 1rem; font-size: .9rem; }
.flash-success { background: #e8f5e9; color: #1b5e20; border: 1px solid #c8e6c9; }
.flash-error   { background: #fdecea; color: #b71c1c; border: 1px solid #f5c6cb; }

.badge { display: inline-block; padding: .15rem .5rem; border-radius: 999px; font-size: .72rem; background: #eee; }
.badge-low { background: #fff3cd; color: #7a5b00; }
.badge-out { background: #fdecea; color: #b71c1c; }

.toolbar { display: flex; gap: .5rem; align-items: center; margin-bottom: 1rem; flex-wrap: wrap; }
.toolbar .spacer { flex: 1; }

/* Login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: #f0f0f2; }
.login-card { width: 340px; background: #fff; padding: 2rem; border-radius: 8px; border: 1px solid #e5e5e7; }
.login-card h1 { text-align: center; margin-bottom: 1.5rem; }

/* Invoice print */
@media print {
  .no-print { display: none !important; }
  body { background: #fff; }
  .invoice { box-shadow: none; border: 0; }
  .app { display: block; }
  .sidebar { display: none; }
  .main { padding: 0; }
}
.invoice {
  max-width: 780px;
  margin: 0 auto;
  background: #fff;
  padding: 2rem 2.5rem;
  border: 1px solid #e5e5e7;
  border-radius: 6px;
}
.invoice .biz-header { text-align: center; border-bottom: 2px solid #1a1a1a; padding-bottom: 1rem; margin-bottom: 1.5rem; }
.invoice .biz-header h1 { font-size: 1.8rem; margin: 0 0 .25rem; letter-spacing: .02em; }
.invoice .biz-header .biz-meta { font-size: .85rem; color: #555; }
.invoice .inv-meta { display: flex; justify-content: space-between; margin-bottom: 1.5rem; font-size: .9rem; }
.invoice table th { background: #fafafa; }
.invoice .totals { margin-left: auto; margin-top: 1rem; width: 280px; }
.invoice .totals td { padding: .35rem .5rem; }
.invoice .totals tr.grand td { font-weight: 700; font-size: 1.05rem; border-top: 2px solid #1a1a1a; }
.invoice .foot { margin-top: 2.5rem; text-align: center; color: #666; font-size: .85rem; border-top: 1px solid #eee; padding-top: 1rem; }
