/* ── Reset & base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  background: #f0f2f5;
  color: #1a1a2e;
  min-height: 100vh;
  padding: 24px 16px;
}

h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 24px;
  color: #003366;
}

h2 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 12px;
  color: #003366;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ── Layout ───────────────────────────────────────────────────────────────── */
.container {
  max-width: 960px;
  margin: 0 auto;
}

.card {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0,0,0,.12);
  padding: 24px;
  margin-bottom: 20px;
}

/* ── Form grid ────────────────────────────────────────────────────────────── */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-group.full-width {
  grid-column: 1 / -1;
}

label {
  font-weight: 500;
  color: #444;
}

input, select, textarea {
  padding: 8px 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 14px;
  width: 100%;
  transition: border-color .15s;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: #0070c0;
  box-shadow: 0 0 0 2px rgba(0,112,192,.15);
}

textarea { resize: vertical; min-height: 60px; }

/* ── Lines table ──────────────────────────────────────────────────────────── */
.table-wrapper { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
}

thead th {
  background: #f5f7fa;
  text-align: left;
  padding: 8px 10px;
  font-weight: 600;
  border-bottom: 2px solid #dee2e6;
  white-space: nowrap;
}

tbody td {
  padding: 6px 8px;
  border-bottom: 1px solid #f0f0f0;
  vertical-align: middle;
}

tbody input, tbody select {
  min-width: 80px;
}

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, opacity .15s;
}

.btn:disabled { opacity: .6; cursor: not-allowed; }

.btn-primary { background: #0070c0; color: #fff; }
.btn-primary:hover:not(:disabled) { background: #005a9e; }

.btn-secondary { background: #e8eaed; color: #333; }
.btn-secondary:hover:not(:disabled) { background: #d2d5db; }

.btn-danger { background: transparent; color: #c0392b; border: 1px solid #c0392b; padding: 4px 8px; font-size: 13px; }
.btn-danger:hover:not(:disabled) { background: #fdecea; }

.btn-sm { padding: 5px 10px; font-size: 13px; }

.actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 8px; }

/* ── Feedback banner ──────────────────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: 4px;
  margin-bottom: 20px;
  font-weight: 500;
  display: none;
}

.alert.visible { display: block; }

.alert-success { background: #e6f4ea; color: #1e6e42; border: 1px solid #b7dfca; }
.alert-error   { background: #fdecea; color: #8b1a1a; border: 1px solid #f5c6c6; }

/* ── Spinner ──────────────────────────────────────────────────────────────── */
.spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  display: none;
}

.btn-primary.loading .spinner { display: inline-block; }
.btn-primary.loading .btn-label { opacity: .7; }

@keyframes spin { to { transform: rotate(360deg); } }
