* { box-sizing: border-box; }
body { font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; margin: 0; background: #f4f6f8; color: #2c3e50; font-size: 14px; }
a { color: #2563eb; text-decoration: none; }
a:hover { text-decoration: underline; }

.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-card { background: #fff; padding: 36px 32px; border-radius: 10px; width: 360px; box-shadow: 0 10px 30px rgba(0,0,0,0.08); }
.login-card h1 { margin: 0 0 4px; font-size: 22px; }
.login-card .muted { color: #6b7280; margin: 0 0 20px; }
.login-card label { display: block; margin: 12px 0 6px; font-weight: 500; }
.login-card input { width: 100%; padding: 10px 12px; border: 1px solid #d1d5db; border-radius: 6px; font-size: 14px; }
.login-card .btn-block { width: 100%; margin-top: 18px; }

.layout { display: flex; min-height: 100vh; }
.sidebar { width: 220px; background: #1f2937; color: #cbd5e1; padding: 20px 0; }
.sidebar h2 { color: #fff; font-size: 16px; padding: 0 20px 16px; margin: 0; border-bottom: 1px solid #374151; }
.sidebar a { display: block; padding: 10px 20px; color: #cbd5e1; }
.sidebar a:hover, .sidebar a.active { background: #374151; color: #fff; text-decoration: none; }
.sidebar .user { padding: 16px 20px; border-top: 1px solid #374151; margin-top: 20px; font-size: 12px; }

.main { flex: 1; padding: 28px 36px; overflow-x: auto; }
.main h1 { margin: 0 0 18px; font-size: 22px; }

.card { background: #fff; border-radius: 8px; padding: 20px; box-shadow: 0 1px 3px rgba(0,0,0,0.05); margin-bottom: 18px; }
.toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; gap: 12px; flex-wrap: wrap; }

table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 8px; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,0.05); }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid #f1f5f9; }
th { background: #f9fafb; font-weight: 600; font-size: 12px; text-transform: uppercase; color: #6b7280; }
tr:last-child td { border-bottom: 0; }
td.right, th.right { text-align: right; }
td.center, th.center { text-align: center; }

.btn { display: inline-block; padding: 8px 14px; border-radius: 6px; border: 1px solid transparent; cursor: pointer; font-size: 13px; font-weight: 500; background: #fff; color: #374151; border-color: #d1d5db; text-decoration: none; }
.btn:hover { background: #f3f4f6; text-decoration: none; }
.btn-primary { background: #2563eb; color: #fff; border-color: #2563eb; }
.btn-primary:hover { background: #1d4ed8; }
.btn-success { background: #16a34a; color: #fff; border-color: #16a34a; }
.btn-success:hover { background: #15803d; }
.btn-danger { background: #dc2626; color: #fff; border-color: #dc2626; }
.btn-danger:hover { background: #b91c1c; }
.btn-sm { padding: 4px 10px; font-size: 12px; }

.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-weight: 500; margin-bottom: 6px; font-size: 13px; }
.form-group input, .form-group select, .form-group textarea {
    width: 100%; padding: 8px 10px; border: 1px solid #d1d5db; border-radius: 6px; font-size: 14px; font-family: inherit;
}
.form-group textarea { min-height: 70px; }
.row { display: flex; gap: 16px; flex-wrap: wrap; }
.col { flex: 1; min-width: 200px; }

.alert { padding: 10px 14px; border-radius: 6px; margin-bottom: 14px; }
.alert-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.alert-error { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert-info { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 12px; font-size: 11px; font-weight: 500; }
.badge-draft { background: #f3f4f6; color: #4b5563; }
.badge-sent { background: #dbeafe; color: #1e40af; }
.badge-paid { background: #dcfce7; color: #166534; }
.badge-cancelled { background: #fee2e2; color: #991b1b; }
.badge-on { background: #dcfce7; color: #166534; }
.badge-off { background: #f3f4f6; color: #6b7280; }

.muted { color: #6b7280; }
.text-right { text-align: right; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.stat { background: #fff; padding: 18px; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.05); }
.stat .num { font-size: 26px; font-weight: 700; color: #1f2937; }
.stat .lbl { color: #6b7280; font-size: 12px; text-transform: uppercase; margin-top: 4px; }

.item-row { display: grid; grid-template-columns: 3fr 1fr 1.5fr 1.5fr 40px; gap: 8px; margin-bottom: 8px; align-items: center; }
.item-row input { width: 100%; padding: 6px 8px; border: 1px solid #d1d5db; border-radius: 4px; }
.item-header { font-size: 12px; font-weight: 600; color: #6b7280; text-transform: uppercase; }
