:root {
  --graphite: #1f2328;
  --graphite-light: #2d333b;
  --steel: #475266;
  --paper: #f4f5f7;
  --card: #ffffff;
  --line: #e1e4e9;
  --ink: #1b1e22;
  --ink-dim: #6b7280;
  --amber: #e8821a;
  --amber-dark: #c86b0f;
  --amber-pale: #fbe6cc;
  --green: #1f8a4c;
  --green-pale: #dcf3e5;
  --red: #c23b3b;
  --red-pale: #fbe0e0;
  --blue: #2a6fb0;
  --blue-pale: #dcebf8;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(20, 22, 26, 0.06), 0 1px 1px rgba(20, 22, 26, 0.04);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--paper);
  color: var(--ink);
  font-size: 14.5px;
  line-height: 1.45;
}

a { color: var(--blue); text-decoration: none; }

button {
  font-family: inherit;
  cursor: pointer;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 500;
  transition: background 0.12s, border-color 0.12s;
}
.btn:hover { background: var(--paper); }
.btn-primary {
  background: var(--amber);
  border-color: var(--amber-dark);
  color: #fff;
}
.btn-primary:hover { background: var(--amber-dark); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--paper); }
.btn-danger { color: var(--red); border-color: var(--red-pale); }
.btn-danger:hover { background: var(--red-pale); }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

input, select, textarea {
  font-family: inherit;
  font-size: 13.5px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  color: var(--ink);
  width: 100%;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--amber);
  box-shadow: 0 0 0 3px var(--amber-pale);
}
label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-dim);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.field { margin-bottom: 14px; }
.row { display: flex; gap: 12px; }
.row > * { flex: 1; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-recibido, .badge-diagnostico { background: var(--blue-pale); color: var(--blue); }
.badge-presupuestado { background: var(--amber-pale); color: var(--amber-dark); }
.badge-aprobado, .badge-en_proceso { background: var(--amber-pale); color: var(--amber-dark); }
.badge-terminado { background: var(--green-pale); color: var(--green); }
.badge-entregado { background: #e9eaec; color: var(--ink-dim); }
.badge-cancelado { background: var(--red-pale); color: var(--red); }
.badge-vencido { background: var(--red-pale); color: var(--red); }
.badge-proximo { background: var(--amber-pale); color: var(--amber-dark); }
.badge-pendiente { background: #e9eaec; color: var(--ink-dim); }

table { width: 100%; border-collapse: collapse; }
th {
  text-align: left;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--ink-dim);
  font-weight: 600;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
}
td {
  padding: 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--paper); }

.empty-state {
  text-align: center;
  padding: 36px 20px;
  color: var(--ink-dim);
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 22, 26, 0.45);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 16px;
  overflow-y: auto;
  z-index: 50;
}
.modal {
  background: var(--card);
  border-radius: var(--radius);
  width: 100%;
  max-width: 640px;
  box-shadow: 0 10px 40px rgba(20, 22, 26, 0.25);
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}
.modal-header h3 { margin: 0; font-size: 16px; }
.modal-body { padding: 20px; }
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
}

.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--graphite);
  color: #fff;
  padding: 11px 16px;
  border-radius: 8px;
  font-size: 13px;
  box-shadow: var(--shadow);
  z-index: 100;
}
.toast.error { background: var(--red); }
