:root {
  --blue: #0c447c;
  --blue-light: #e6f1fb;
  --teal: #0f6e56;
  --teal-light: #e1f5ee;
  --coral: #993c1d;
  --coral-light: #faece7;
  --gray-text: #444441;
  --gray-light: #f1efe8;
  --border: #d3d1c7;
  --danger: #a32d2d;
  --danger-light: #fcebeb;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
  margin: 0;
  background: #faf9f6;
  color: #222;
  font-size: 16px;
  line-height: 1.5;
}

.topbar {
  background: var(--blue);
  color: white;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar a { color: white; text-decoration: none; }
.topbar .brand { font-weight: 600; font-size: 17px; }
.topbar .user-info { font-size: 13px; opacity: 0.9; }

.nav {
  display: flex;
  gap: 4px;
  background: white;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  position: sticky;
  top: 48px;
  z-index: 9;
}
.nav a {
  padding: 12px 16px;
  text-decoration: none;
  color: var(--gray-text);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  border-bottom: 3px solid transparent;
}
.nav a.active {
  color: var(--blue);
  border-bottom-color: var(--blue);
}

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 16px;
}

.card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}

h1 { font-size: 20px; margin: 0 0 4px; }
h2 { font-size: 17px; margin: 0 0 12px; }
h3 { font-size: 15px; margin: 0 0 8px; }
.subtitle { color: #777; font-size: 13px; margin-bottom: 16px; }

label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--gray-text);
}

input, select, textarea {
  width: 100%;
  padding: 12px;
  font-size: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 14px;
  background: white;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-light);
}

.btn {
  display: inline-block;
  padding: 13px 20px;
  font-size: 16px;
  font-weight: 600;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  min-height: 48px;
}
.btn-primary { background: var(--blue); color: white; }
.btn-primary:hover { background: #093561; }
.btn-success { background: var(--teal); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-secondary { background: var(--gray-light); color: var(--gray-text); }
.btn-block { display: block; width: 100%; }
.btn-sm { padding: 8px 14px; font-size: 14px; min-height: auto; }

.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); }
th { color: #777; font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.03em; }
tr:last-child td { border-bottom: none; }

.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 600;
}
.badge-blue { background: var(--blue-light); color: var(--blue); }
.badge-teal { background: var(--teal-light); color: var(--teal); }
.badge-coral { background: var(--coral-light); color: var(--coral); }
.badge-danger { background: var(--danger-light); color: var(--danger); }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
.stat-box {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
}
.stat-box .num { font-size: 26px; font-weight: 700; color: var(--blue); }
.stat-box .lbl { font-size: 12px; color: #888; margin-top: 2px; }

.alert {
  padding: 12px 14px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 14px;
}
.alert-success { background: var(--teal-light); color: var(--teal); }
.alert-error { background: var(--danger-light); color: var(--danger); }

.line-item-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  margin-bottom: 8px;
  padding: 10px;
  background: var(--gray-light);
  border-radius: 8px;
}
.line-item-row > div { flex: 1; margin-bottom: 0; }
.line-item-row input, .line-item-row select { margin-bottom: 0; }
.remove-row-btn {
  background: var(--danger-light);
  color: var(--danger);
  border: none;
  border-radius: 6px;
  width: 40px;
  height: 44px;
  font-size: 18px;
  cursor: pointer;
}

.section-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 20px 0;
}

@media print {
  .topbar, .nav, .no-print { display: none !important; }
}

@media (max-width: 480px) {
  .stat-grid { grid-template-columns: 1fr 1fr; }
  table { font-size: 13px; }
  th, td { padding: 8px 4px; }
}
