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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  color: #1a1a2e;
  background: #f8f9fa;
  line-height: 1.5;
}

a { color: #1a1a2e; }

nav {
  background: #1a1a2e;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 24px;
}

nav a {
  color: #ccc;
  text-decoration: none;
  font-size: 13px;
}

nav a:hover, nav a.active { color: #fff; }

nav .brand {
  font-weight: 600;
  font-size: 15px;
  color: #fff;
  margin-right: 16px;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
}

h1 { font-size: 1.5em; margin-bottom: 16px; }
h2 { font-size: 1.2em; margin-bottom: 12px; color: #333; }
h3 { font-size: 1em; margin-bottom: 8px; color: #555; }

.card {
  background: #fff;
  border-radius: 6px;
  padding: 20px;
  margin-bottom: 16px;
  border: 1px solid #e9ecef;
}

.grid { display: grid; gap: 16px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }

.stat { text-align: center; }
.stat .value { font-size: 1.8em; font-weight: 700; }
.stat .label { font-size: 0.85em; color: #666; }
.stat.warn .value { color: #dc3545; }
.stat.good .value { color: #198754; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 2px solid #1a1a2e;
  font-weight: 600;
  font-size: 0.85em;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #555;
}

td {
  padding: 8px 10px;
  border-bottom: 1px solid #eee;
  white-space: nowrap;
}

td.wrap {
  white-space: normal;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

tr:hover td { background: #f8f9fa; }

.text-right { text-align: right; }
.text-center { text-align: center; }
.text-muted { color: #888; }
.text-sm { font-size: 0.85em; }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 0.8em;
  color: #fff;
}
.badge-draft { background: #6c757d; }
.badge-sent { background: #0d6efd; }
.badge-paid { background: #198754; }
.badge-overdue { background: #dc3545; }

.uninvoiced { }

.btn {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 4px;
  border: 1px solid #ccc;
  background: #fff;
  color: #333;
  font-size: 13px;
  cursor: pointer;
  text-decoration: none;
}

.btn:hover { background: #f0f0f0; }

.btn-primary {
  background: #1a1a2e;
  color: #fff;
  border-color: #1a1a2e;
}

.btn-primary:hover { background: #2a2a4e; }

.btn-sm { padding: 3px 10px; font-size: 12px; }

.btn-success { background: #198754; color: #fff; border-color: #198754; }
.btn-danger { background: #dc3545; color: #fff; border-color: #dc3545; }

.actions { display: flex; gap: 6px; align-items: center; }

form.inline { display: inline; }

.form-group {
  margin-bottom: 12px;
}

.form-group label {
  display: block;
  font-weight: 600;
  font-size: 0.85em;
  margin-bottom: 4px;
  color: #555;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 14px;
  font-family: inherit;
}

.form-group textarea { min-height: 80px; resize: vertical; }

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

.flash {
  padding: 10px 16px;
  border-radius: 4px;
  margin-bottom: 16px;
  background: #d1ecf1;
  border: 1px solid #bee5eb;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.tab-bar {
  display: flex;
  gap: 0;
  border-bottom: 2px solid #dee2e6;
  margin-bottom: 16px;
}

.tab-bar a {
  padding: 8px 16px;
  text-decoration: none;
  color: #666;
  font-size: 13px;
  font-weight: 500;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
}

.tab-bar a.active {
  color: #1a1a2e;
  border-bottom-color: #1a1a2e;
}

@media (max-width: 640px) {
  .grid-3 { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
}
